将函数移动到不同的文件

时间:2017-10-31 09:55:58

标签: c++ include directory

我有一个功能可以在文件内部的3D弧内获取点,但是,尝试将代码排序到相应的文件夹中,我打破了它,我不知道为什么因为我认为我包括它正确。

最初很多计算都在文件" messages.cpp"中,但它应该只包含消息,计算应该在Calculations文件夹中。

所以现在messages.cpp是这样的:

#include "../../FGProcessorModule/Calculations/ArcToPoints.h"
namespace myNamespace {
void MsgProvider::onEvent{
std::vector<Formulas::LLPoint> allPoints = ArcToPoints(center, start, end);
}
}

In&#34; ../../ FGProcessorModule / Calculations / ArcToPoints.h&#34;我有:

#ifndef ARCTOPOINTS_H
#define ARCTOPOINTS_H

#include blablabla

namespace myNamespace{

std::vector<Formulas::LLPoint> ArcToPoints (Formulas::LLPoint, Formulas::LLPoint, Formulas::LLPoint);

}

#endif /* ARCTOPOINTS_H */

最后在&#34; ../../ FGProcessorModule / Calculations / ArcToPoints.cpp&#34;我有:

#include "ArcToPoints.h"
namespace myNamespace{
std::vector<Formulas::LLPoint> ArcToPoints (Formulas::LLPoint center, Formulas::LLPoint start, Formulas::LLPoint end){
        //Lots of calculations
}
}

我认为一切正常但我想在编译时收到此错误:

  

未定义对`FVIS :: ArcToPoints(Formulas :: LLPoint,   Formulas :: LLPoint,Formulas :: LLPoint)&#39;

2 个答案:

答案 0 :(得分:0)

请显示在“未定义参考...”错误之前发生的构建步骤命令。如果您正在使用它,可以在Eclipse的控制台窗口中看到它。

答案 1 :(得分:0)

我不知道这是否会对其他人有所帮助,因为这是一个非常具体的问题,这是一个使用ros和catkin的项目。

我遗失了包括CMakeLists.txt中新创建的文件。现在编译得很好。

相关问题