By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

undefined reference

P: 13
Hi there,

I'm relatively new at C++ and I'm wondering if I can get some help on this error I'm having. I'm trying to run this sample code I have that should be correct. All of my files compile successfully, but when I try to run them, I get the following error:

g++.exe C:\DOCUME~1\Owner\Desktop\499\Main.o -o C:\DOCUME~1\Owner\Desktop\499\Main.exe -Wall -fpermissive -Wno-sign-compare -g
C:\DOCUME~1\Owner\Desktop\499\Main.o: In function `main':
//C/DOCUME~1/Owner/Desktop/499/Main.cpp:11: undefined reference to `Name::Name(char *)'
//C/DOCUME~1/Owner/Desktop/499/Main.cpp:12: undefined reference to `Name::print(void)'

I have the class Name separated into .h and .cpp file and I'm running the program on a separate main method file main.cpp.
I am using compiler Jens' File Editor - GCC.

I'd really appreciate any help I can get....since I can't get anywhere on any programs with this error.

Mar 12 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,510
sounds like you need to link the files together, e.g. at the command line
gpp main.cpp name.cpp

or if you are using an IDE add both .cpp files to the project
Mar 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.