• Advertisement

Archived

This topic is now archived and is closed to further replies.

I don't get GCC to work ???

This topic is 5810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to compile c++ programs on windows using GCC (3.02). I''m compiling programs for the ARM-processor (GameBoyAdvance games, actually ). When I have typed g++ main.cpp -c and obtained "main.o", what shall I do next? I know I have to use the linker "ld main.o ....." but I''ve no idea which files I should link to ! So the linker says undefined reference to `_Unwind_SjLj_Register'' undefined reference to `__gccmain'' undefined reference to `operator new(unsigned long)'' undefined reference to `operator delete(void*)'' undefined reference to `printf'' What files should I link to? I tried to include "crt0.s" and wrote "ld main.o crt0.s" but this didn''t work (crt0.s must be included I think?). Thanks for any help !

Share this post


Link to post
Share on other sites
Advertisement
I''ve never done anything for an ARM. For GCC, .s is a common extension for assembly language files. Check the .s file that you say you need, see if it is assembly. If it is, try something like this:

as -o crt0.o -c crt0.s
g++ -o main.o -c main.cpp
ld -o final_file main.o crt0.o



Share this post


Link to post
Share on other sites
If all you want to do is link with the standard runtime libraries and startup code, it's easier to let g++ do the linking (it will invoke ld for you).

g++ -c -o main.o main.cpp
g++ -o main main.o

The second command will link main.o and the relevant library/startup code into the executable "main".



[edited by - spock on May 31, 2002 7:00:23 AM]

Share this post


Link to post
Share on other sites

  • Advertisement