My project setting is
- Xcode 8.3 (8E162)
- Language C++
My project structure is
├── README.md
├── TrollLanguage
│ ├── TokenParser.cpp
│ ├── TokenParser.hpp
│ └── main.cpp
My source code is
main.cpp
#include <iostream>
#include "TokenParser.hpp"
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
TokenParser *tokenParser = new TokenParser();
tokenParser->TestFunc();
return 0;
}
TokenParser.cpp
#include "TokenParser.hpp"
void TestFunc() {
std::cout << "can u see me?";
}
enter code here
TokenParser.hpp
#ifndef TokenParser_hpp
#define TokenParser_hpp
#include <iostream>
class TokenParser {
public:
void TestFunc();
};
#endif /* TokenParser_hpp */
Expected behavior is
Hello, World!
can u see me?
Actual behavior is
Apple Mach-O Linker (Id) Error
"TokenParser::TestFunc()", referenced from:
Linker command failed with exit code 1(use -v to see invocation