我知道这已经被问了数千次,但我很难过。我一直在寻找过去3天没有结果。我不断收到这个错误,我不知道为什么。我只添加了我输入的/重要的代码。如果我注释掉我的代码,程序编译没有问题。我究竟做错了什么???
CMakeFiles/brewtarget.dir/MainWindow.cpp.o:在函数 MainWindow::MainWindow(QWidget*)' 中:MainWindow.cpp:(.text+0xb145):未定义对酵母CellCounter::yeastCellCounter()' 的引用
CODE
主窗口.cpp
#include "yeastcellcounter.h"
// a whole lot of stuff between these...
yeastCountDialog = new yeastCellCounter();
主窗口.h
class yeastCellCounter;
// A whole log of stuff between these...
yeastCellCounter *yeastCountDialog;
yeascellcounter.cpp
#include "yeastcellcounter.h"
yeastCellCounter::yeastCellCounter(){}
酵母细胞计数器.h
#ifndef YEASTCELLCOUNTER_H
#define YEASTCELLCOUNTER_H
class yeastCellCounter
{
public:
yeastCellCounter();
};
#endif // YEASTCELLCOUNTER_H
这是 cmakelist.txt 中的 INCLUDE_DIRECTORIES 指令
SET(ROOTDIR "${CMAKE_CURRENT_SOURCE_DIR}")
SET(SRCDIR "${ROOTDIR}/src")
SET(UIDIR "${ROOTDIR}/ui")
SET(DATADIR "${ROOTDIR}/data")
SET(TRANSLATIONSDIR "${ROOTDIR}/translations")
SET(WINDIR "${ROOTDIR}/win")
INCLUDE_DIRECTORIES(${SRCDIR})
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/src") # In case of out-of-source build.
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/QtDesignerPlugins")