Undefined reference C++

后端 未结 2 1159
清酒与你
清酒与你 2020-12-01 23:42

I\'m trying to compile my first legit program that I\'m converting from Java (I ran a test hello world type program to check my compiler and it works). There are three files

相关标签:
2条回答
  • 2020-12-02 00:13

    You may be compiling skewNormal.cpp to a .o file, but you're not including it when you compile main.cpp.

    0 讨论(0)
  • 2020-12-02 00:33

    Not sure if this is the problem, but it appears you're prototyping the function twice.

    The double getSkewNormal(double skewValue, double x); line need only be in the header, not in main.cpp as well (since main.cpp includes skewNormal.h). Having it appear twice in a prototype form seems likely to confuse the compiler. You only need it to be visible to the code once, and usually that should be in a header (not a code file).

    Try removing that line from main.cpp and recompile. :)

    0 讨论(0)
提交回复
热议问题