我试图让它编译,但每次我去编译 main.cpp 我都会得到同样的错误:
Undefined symbols for architecture x86_64:
"tlogic::tlogic()", referenced from:
_main in ccAcayG4.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
我尝试调试了一段时间,但错误似乎仍然存在。任何帮助,将不胜感激。
这是main.cpp:
#include <iostream>
using namespace std;
#include "tlogic.h"
int main()
{
tlogic test;
exit(EXIT_SUCCESS);
}
tlogic.h:
#ifndef TLOGIC_H
#define TLOGIC_H
class tlogic {
public:
tlogic();
tlogic(bool);
~tlogic();
void init();
void get_command();
private:
bool debug;
};
#endif
最后,tlogic.cpp:
#include <iostream>
using namespace std;
#include "tlogic.h"
tlogic::tlogic()
{
cout << "Testing" << endl;
debug = false;
}
tlogic::tlogic(bool debug_)
{
cout << "Testing 2" << endl;
debug = debug_;
}
tlogic::~tlogic()
{
}
void tlogic::game_init()
{
}
void tlogic::get_command()
{
}
感谢您的帮助。
编辑:固定 tlogic::glogic 等。