我在 MAC OS X 上的 Eclipse 中有一个持久的未定义符号错误。我无法找出错误的来源。
当我尝试使用下面的 GA_Operations 和 gaAlgorithm->run_algorithm..... 时,根据编译器会发生错误:
int Application::execute_Algorithm()
{
if (this->GA_On)
{
GA_Operations *gaAlgorithm = new GA_Operations();
gaAlgorithm->run_algorithm(blocksSequence, bins);
}
else
{
packingAlgorithm->run_algorithm(blocksSequence, bins); return 0;
} //
return 0;
}
显示的错误是:
Undefined symbols for architecture x86_64:
"binproject::GA_Operations::run_algorithm(binproject::Blocks_Sequence&, binproject::BinContainer&)", referenced from:
binproject::Application::execute_Algorithm() in Application.o
"binproject::GA_Operations::GA_Operations()", referenced from:
binproject::Application::execute_Algorithm() in Application.o
声明是:
class GA_Operations {
public:
GA_Operations();
~GA_Operations();
//call from main application to execute algorithm
void run_algorithm(Blocks_Sequence &b_seq, BinContainer &container);
...
};
每当我尝试在实现 (CPP) 文件中定义声明的函数时,它也会引发类似的错误。
有任何想法吗?这似乎只发生在这个类中。
另外,如果代码缩进有问题,我深表歉意,我