我已阅读有关此主题的其他问题,但仍未弄清楚如何解决我的问题
预先感谢您的帮助!
我的错误是:
架构 x86_64 的未定义符号:“Record::Record(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > >, double* )”,引用自:akh70P3ClassTester-946637.old 中的_main:找不到架构 x86_64 的符号
#include <string>
#include <vector>
using namespace std;
class Record
{
public:
Record();
Record(vector<string> , double []);
private:
//some variables
};
Run Code Online (Sandbox Code Playgroud)
#include "Record.h"
#include <string>
#include <vector>
using namespace std;
Record::Record() {}
Record::Record(vector<string> inputs, double num_inputs[] )
{
//variables happens
}
Run Code Online (Sandbox Code Playgroud)
#include "Record.h"
#include <vector>
using namespace std;
int main() {
vector<string> inputs;
double num_inputs[] = {};
Record temp(inputs, num_inputs);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
您可能没有在编译中包含 Report.cpp,例如只做 g++ main.cpp -o main
相反,通过包含报告文件来编译您的程序: g++ main.cpp report.cpp -o main