这可能很简单,但我无法弄清楚。未定义的静态方法引用
在我main.cpp中我有:
Image image("/path/to/image.png");
int* h = ImageProcessor::dailyPrices(image);
在我ImageProcessor.h我:
//Maybe something is wrong with this? I am trying to forward declare.
namespace Magick
{
class Image;
}
class ImageProcessor {
public:
ImageProcessor();
virtual ~ImageProcessor();
static int* dailyPrices(const Magick::Image& abp_chart);
};
而在ImageProcessor.cpp我有
int* dailyPrices(const Image& abp_chart)
{
但在尝试编译后,我在main.cpp中收到以下错误:
path/to/VendBot.cpp:17: undefined reference to `ImageProcessor::dailyPrices(Magick::Image const&)'
int * ImageProces sor :: dailyPrices(const Image&abp_chart)' –
[与g ++链接时未定义对函数的引用]的重复(http://stackoverflow.com/questions/7043333/undefined-reference-to-a-function-when-与g)链接 –
织补。更多的工作来找到重复而不是回答。并没有rep的收益。 –