Results 1 to 7 of 7

Thread: C++ compilation Problems

                  
   
  1. #1
    DCEmu Newbie
    Join Date
    Nov 2005
    Location
    Germany
    Posts
    59
    Rep Power
    0

    Default C++ compilation Problems

    Hi

    when I try to compile my main.cpp, I get this:

    main.o: In function `main':
    main.cpp:(.text+0xf0): undefined reference to `initGraphics()'
    main.cpp:(.text+0xfc): undefined reference to `loadImage(char const*)'
    main.cpp:(.text+0x108): undefined reference to `loadImage(char const*)'
    main.cpp:(.text+0x114): undefined reference to `loadImage(char const*)'
    main.cpp:(.text+0x120): undefined reference to `loadImage(char const*)'
    main.cpp:(.text+0x12c): undefined reference to `loadImage(char const*)'
    main.cpp:(.text+0x230): undefined reference to `clearScreen(unsigned int)'
    main.cpp:(.text+0x27c): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x2d0): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x32c): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x394): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x3e8): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x3f0): undefined reference to `flipScreen()'
    main.cpp:(.text+0x4a4): undefined reference to `clearScreen(unsigned int)'
    main.cpp:(.text+0x4ec): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x534): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x580): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x5d8): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x630): undefined reference to `printTextScreen(int, int, char c
    onst*, unsigned int)'
    main.cpp:(.text+0x638): undefined reference to `flipScreen()'
    collect2: ld returned 1 exit status
    make: *** [pspwAMPxmb.elf] Error 1
    I do have #included "graphics.h" and the makefile contains OBJS = main.o graphics.o framebuffer.o

    What do I do wrong?

  2. #2
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    Looks like you haven't linked in the libraries need for the graphics functions that you are using. Are you linking with gcc or g++?

  3. #3
    DCEmu Newbie
    Join Date
    Nov 2005
    Location
    Germany
    Posts
    59
    Rep Power
    0

    Default

    gcc. The wierd thing is I defninitely have linked and included everything correctly. It seems that you can't use the C graphics.h libraries in C++...

  4. #4
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    Yes you can. Again, are you linking with gcc or g++?

  5. #5
    DCEmu Newbie
    Join Date
    Nov 2005
    Location
    Germany
    Posts
    59
    Rep Power
    0

    Default

    gcc

  6. #6
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    If you are using C++ you MUST compile AND link with g++ NOT gcc.

  7. #7
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    Beyond the above error, your code/file structure is at fault. Host up ALL your code on to a server somewhere so people can download it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •