I must be missing something obvious, thanks for the help.
Coding in C++. IDE is Clion.
In my main.cpp I call a Parser::parse(tokenList)
function.
The Parse function is declared in Parser.h as static std::string parse (std::vector<Token*>& tokenList);
I define the function in Parser.cpp as std::string Parser::parse (std::vector<Token*> &tokenList){return "";}
In my main.cpp file I #include "Parser.h"
When I build my project I get undefined reference to 'Parser::parse(std::vector<Token*, std::allocator<Token*> >&)'
Am I defining incorrectly?
I have similar code with the same problem. In that example, including the .cpp file instead of the .h file resolves the issue. Why would that be (yes, I know including the .cpp is bad practice)?
Asked
Active
Viewed 51 times
0

Ragiarc
- 9
-
Descriptions of code pale in comparison to code. – user4581301 Sep 28 '20 at 20:04
-
You're supposed to compile all .cpp files. – cigien Sep 28 '20 at 20:04
-
1Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please learn how to [edit] your posts, for example to improve their [formatting](https://stackoverflow.com/help/formatting) and including a [mcve]. – Some programmer dude Sep 28 '20 at 20:10