c++ “ undefined reference to 'Foo::Foo(std::string)' ”

前端 未结 2 1853
旧巷少年郎
旧巷少年郎 2020-12-11 23:31

I\'m not too familiar with c++ and how instantiating objects work, so this is probably a very simple thing to solve. When I compile with g++ I get the error \" undefined re

2条回答
  •  渐次进展
    2020-12-12 00:13

    You're probably not including Foo.cpp in your compile line. It should look something like this:

    g++ main.cpp Foo.cpp -o testFoo
    

提交回复
热议问题