Undefined reference to

為{幸葍}努か 提交于 2019-12-02 06:29:00

Describe your build process. It looks as though you're not building List.cpp, or else not linking it with main.cpp.

You're not compiling List.cpp. Add it to the command line.

In main.cpp, it's seeing (from List.h) "Hey, this class with this functionality will exist", but since you're not actually building/linking with List.cpp, it can't find the functions it's looking for.

Your command line should look something like g++ -o test.exe main.cpp List.cpp.

The key feature being to include both main.cpp and List.cpp.

There are other ways to do this, but this should get you started.

Your problem is not including all the different files in your command line arg compiler

Correct format:

get in correct directory

gcc -o list main.cpp List.cpp List.h

then you won't get anymore undefined references to functions

Good luck on building your 3 or 4 year old program...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!