Undefined reference to class constructor, including .cpp file fixes

前端 未结 6 1640
萌比男神i
萌比男神i 2020-12-24 14:14

The problem I am having is that, when I call a constructor for a class I have created I get the following error.

main.cpp:20: undefined reference to

6条回答
  •  忘掉有多难
    2020-12-24 14:31

    I had the same issue but mine was because I'm using Eclipse CDT with and Autotools project. So I had to manually add the new .h and .cpp files to the corresponding Makefile.am, and then do a project > reconfigure project, rebuild, an that was it.

提交回复
热议问题