Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a cpp in which i am using 2 classes from a hpp and defining the functions declared in the hpp. However when i compile the error comes :


g++ file.cpp
Undefined first referenced
symbol in file
main /auto/gnu/gcc/4.2.1/bin/../lib/gcc/sparc-sun-solaris2.10/4.2.1/crt1.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Posted
Updated 28-Sep-11 21:01pm
v2
Comments
[no name] 29-Sep-11 4:14am    
Is there some additional information here?

1 solution

It would appear that module my570list.cpp does not contain a main() function as required for creating an executable from CPP source code. If you are merely trying to compile into object form then add the -c option to your compile command thus:
g++ -c my570list.cpp
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900