cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Help with Hw
Help with Hw
Oct 11, 2015 at 8:05am UTC
SSnr
(2)
So I'm having troubling splitting this code into each file.
Main code in one file that works:
http://pastebin.com/cy8iirqP
My error after attempt on separating it.
[Linker error] undefined reference to `human::human()'
[Linker error] undefined reference to `elf::elf()'
[Linker error] undefined reference to `cyberdemon::cyberdemon()'
[Linker error] undefined reference to `balrog::balrog()'
etc....
Am I forgetting something? Any tips where to look would be appreciated
My attempt on separating it
client.cpp
http://pastebin.com/qny6hEt3
balrog.cpp
http://pastebin.com/UMifr5TV
balrog.h
http://pastebin.com/1nja0TS6
creature.cpp
http://pastebin.com/KEtF9G42
creature.h
http://pastebin.com/7RsHMVNZ
cyberdemon.cpp
http://pastebin.com/HTag2SfF
cyberdemon.h
http://pastebin.com/wP6gar6b
demon.cpp
http://pastebin.com/4Teikcw1
demon.h
http://pastebin.com/yAt4YFBK
elf.cpp
http://pastebin.com/afvbPWTK
elf.h
http://pastebin.com/TNDz2Qwj
human.cpp
http://pastebin.com/NUYgJeMX
human.h
http://pastebin.com/YvRm2HG3
Last edited on
Oct 11, 2015 at 8:20am UTC
Oct 11, 2015 at 8:50am UTC
Peter87
(11154)
"undefined reference" means the linker can't find where thing it complains about is define. Make sure you compile and link all source (.cpp) files. If you use an IDE this is usually done automatically if you have all files in the same project.
Last edited on
Oct 11, 2015 at 8:52am UTC
Oct 11, 2015 at 9:48am UTC
SSnr
(2)
Yeah you were right i was compiling them separately using dev-c++ and not making a project. Thanks I finally got it working
Topic archived. No new replies allowed.