View previous topic :: View next topic |
Author |
Message |
clockwise Apprentice
Joined: 24 Aug 2002 Posts: 152 Location: uk
|
Posted: Fri Aug 29, 2003 11:52 pm Post subject: g++ error - undefined reference to `main' |
|
|
could someone throw me a bone (even a frikkin' one) here, it's late and i'm pretty sure i'm missing something obvious.
Code: | $ g++ Vector.cpp -o Vector.o
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status |
thanks. _________________ "if an injury has to be done to a man it should be so severe that his vengeance need not be feared." - niccolò machiavelli |
|
Back to top |
|
|
MJN222 Tux's lil' helper
Joined: 24 Nov 2002 Posts: 77 Location: Livermore, CA
|
Posted: Sat Aug 30, 2003 12:20 am Post subject: |
|
|
What's the code you're trying to compile?
Do you have a main() function defined? g++ is trying to create an executable, so its looking for main() when its linking. Try going this:
Code: | g++ -c -o Vector.o Vector.cpp |
That should let it compile...
HTH
edit: The -c tells g++ (or gcc for that matter) that it should only compile, not link. _________________ Do you lock your car when you leave it out in public? Why not do the same with your computer? |
|
Back to top |
|
|
clockwise Apprentice
Joined: 24 Aug 2002 Posts: 152 Location: uk
|
Posted: Sat Aug 30, 2003 9:24 am Post subject: |
|
|
thank you, that was indeed the problem. _________________ "if an injury has to be done to a man it should be so severe that his vengeance need not be feared." - niccolò machiavelli |
|
Back to top |
|
|
|