LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GCC g++ error using classes (https://www.linuxquestions.org/questions/programming-9/gcc-g-error-using-classes-180936/)

bru 05-12-2004 11:25 PM

GCC g++ error using classes
 
Dose anyone know what this means??? I sure don't

Code:

g++ VideoClassTypeburnett6.cpp
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
collect2: ld returned 1 exit status

Thanks in advance,

jtshaw 05-13-2004 03:21 AM

It means that you don't have a main function in VideoClassTypeburnett6.cpp. At least that is my best guess looking at the message.

Usually when you compile a project at least one of the functions has a main somewhere which gets the ball rolling so to speak. It isn't that each cpp file needs a main, but when it links it and tries to make an executable from it the compiler needs to know where to start.

Read your compiler manual. It'll tell you all sorts of nice things like how to just build object files. In this case you probably want g++ -c VideoClassTypeburnett6.cpp though I would also recommend you use the -Wall and -pedantic option.

bru 05-13-2004 11:01 AM

Thanks jtshaw


All times are GMT -5. The time now is 07:02 AM.