C++ 链接器命令失败,退出代码为1 C++; 我的项目设置是 代码8.3(8E162) C语言++ 我的项目结构是 我的源代码是 main.cpp 实际行为是
您需要在实现文件中作为函数定义的一部分预先添加类名。目前,您正在定义一个名为C++ 链接器命令失败,退出代码为1 C++; 我的项目设置是 代码8.3(8E162) C语言++ 我的项目结构是 我的源代码是 main.cpp 实际行为是,c++,xcode,C++,Xcode,您需要在实现文件中作为函数定义的一部分预先添加类名。目前,您正在定义一个名为TestFunc的自由函数 #include "TokenParser.hpp" void TokenParser::TestFunc() { std::cout << "can u see me?"; } #包括“TokenParser.hpp” void TokenParser::TestFunc(){ std::cout It build success,但看不到(你能看到我吗?)奇怪。或者
TestFunc
的自由函数
#include "TokenParser.hpp"
void TokenParser::TestFunc() {
std::cout << "can u see me?";
}
#包括“TokenParser.hpp”
void TokenParser::TestFunc(){
std::cout It build success,但看不到(你能看到我吗?)奇怪。或者添加std::cout如果您的问题得到解决,请接受回答Stack overflow说,等待2分钟。抱歉。
#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;
}
#include "TokenParser.hpp"
void TestFunc() {
std::cout << "can u see me?";
}
enter code here
#ifndef TokenParser_hpp
#define TokenParser_hpp
#include <iostream>
class TokenParser {
public:
void TestFunc();
};
#endif /* TokenParser_hpp */
Hello, World!
can u see me?
Apple Mach-O Linker (Id) Error
"TokenParser::TestFunc()", referenced from:
Linker command failed with exit code 1(use -v to see invocation
#include "TokenParser.hpp"
void TokenParser::TestFunc() {
std::cout << "can u see me?";
}