Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) undefined reference to 'puts'

 

Qt CreatorUbuntuNDS

 

Link error.

 

 

 

 

 

Operating system(s):

IDE(s):

Project type:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-10-07T22:25:11
#
#-------------------------------------------------
INCLUDEPATH += /opt/devkitpro/libnds-1.4.7/include
INCLUDEPATH += /opt/devkitpro/devkitARM/arm-eabi/include
LIBS += -L/opt/devkitpro/libnds-1.4.7/lib -lnds9
DEFINES += ARM9
TARGET = CppDsExample1
CONFIG   += console
CONFIG -= qt
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
OTHER_FILES += \
    makefile_supplied.txt
QMAKE_CC = /opt/devkitpro/devkitARM/bin/arm-eabi-g++
QMAKE_CXX = /opt/devkitpro/devkitARM/bin/arm-eabi-g++
QMAKE_LINK = /opt/devkitpro/devkitARM/bin/arm-eabi-ld

 

 

 

 

 

main.cpp

 

//////////////////////////////////////////////////////////////////////
// Demo1 ARM9 Code - Based on an example shipped with NDSLIB.
// Chris Double (chris.double@double.co.nz)
//////////////////////////////////////////////////////////////////////

//From http://double.co.nz/nintendo_ds/nds_develop1.html
#include <nds.h>
#include <nds/registers_alt.h>
#include <nds/arm9/console.h>
#include <stdio.h>

int main(void)
{
  // Use the touch screen for output
  videoSetMode(0);
  videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
  vramSetBankC(VRAM_C_SUB_BG);
  SUB_BG0_CR = BG_MAP_BASE(31);

  // Set the colour of the font to White.
  BG_PALETTE_SUB[255] = RGB15(31,31,31);

  consoleInit(0,1, BgType_Text4bpp, BgSize_T_256x256, 0, 6, false, true);
  /*
  consoleInit(
    consoleGetDefault(),
    0,
    (u16*)SCREEN_BASE_BLOCK_SUB(31),
    (u16*)CHAR_BASE_BLOCK_SUB(0),
    16);
  */

  printf("\n\n\tHello World!\n");
  while(1) {
    touchPosition touchXY = touchReadXY();
    printf("\x1b[10;0H");
    printf("Touch x = %d   \n", touchXY.px);
    printf("Touch y = %d   \n", touchXY.py);
  }
  return 0;
}

 

 

 

 

 

Solution

 

Change the linker from 'arm-eabi-ld' to 'arm-eabi-gcc' in the Qt project file:

 

QMAKE_LINK = /opt/devkitpro/devkitARM/bin/arm-eabi-gcc

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict