HTH, - J. Newbe C++ programmer.I am trying to bug fix a simple KDE application that uses C++. Thereis a main directory with .cpp & .h files in it. I need to write someadditional code and split it up into .cpp & .h files. The code - noproblem. The splitting into ,h & .cpp is the problem. Stripping theproblem to its very bare bones I have ...ctallowdeny.h .../////////////////////////////////////////////////////////////////////class ctallowdeny{public:ctallowdeny();~ctallowdeny();}/////////////////////////////////////////////////////////////////////////////ctallowdeny.cpp ...//////////////////////////////////////////////////////////////////////////////#include "ctallowdeny.h"using namespace std;ctallowdeny::ctallowdeny() {};ctallowdeny::~ctallowdeny() {};///////////////////////////////////////////////////////////////////////and called from KTApp with ...#include "ctallowdeny.h"ctallowdeny testbedWhen I make I get ...ktapp.o: In function `KTApp::KTApp()'':ktapp.cpp:(.text+0x28df): undefined reference to`ctallowdeny::ctallowdeny()''ktapp.cpp:(.text+0x2a4d): undefined reference to`ctallowdeny::~ctallowdeny()''ktapp.o: In function `KTApp::KTApp()'':ktapp.cpp:(.text+0x2b49): undefined reference to`ctallowdeny::ctallowdeny()''ktapp.cpp:(.text+0x2cc4): undefined reference to`ctallowdeny::~ctallowdeny()''collect2: ld returned 1 exit statusmake[2]: *** [kcron] Error 1make[2]: Leaving directory `/home/ubuntu/Desktop/kdeadmin-3.5.5/kcron''make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/ubuntu/Desktop/kdeadmin-3.5.5''make: *** [all] Error 2ubuntu@ubuntu-desktop:~/Desktop/kdeadmin-3.5.5$//////////////////////////////////////////////////////////////////////Any ideas ? - I have been stuck on this for several hours :(Dave 解决方案//////////////////////////////////////////////////////////////////////Any ideas ? - I have been stuck on this for several hours :(Dave da******@googlemail.com wrote:Newbe C++ programmer.I am trying to bug fix a simple KDE application that uses C++. Thereis a main directory with .cpp & .h files in it. I need to write someadditional code and split it up into .cpp & .h files. The code - noproblem. The splitting into ,h & .cpp is the problem. Stripping theproblem to its very bare bones I have ...ctallowdeny.h .../////////////////////////////////////////////////////////////////////class ctallowdeny{public: ctallowdeny(); ~ctallowdeny();}/////////////////////////////////////////////////////////////////////////////ctallowdeny.cpp ...//////////////////////////////////////////////////////////////////////////////#include "ctallowdeny.h"using namespace std;ctallowdeny::ctallowdeny() {};ctallowdeny::~ctallowdeny() {};///////////////////////////////////////////////////////////////////////and called from KTApp with ...#include "ctallowdeny.h"ctallowdeny testbedWhen I make I get ...ktapp.o: In function `KTApp::KTApp()'':ktapp.cpp:(.text+0x28df): undefined reference to`ctallowdeny::ctallowdeny()''ktapp.cpp:(.text+0x2a4d): undefined reference to`ctallowdeny::~ctallowdeny()''ktapp.o: In function `KTApp::KTApp()'':ktapp.cpp:(.text+0x2b49): undefined reference to`ctallowdeny::ctallowdeny()''ktapp.cpp:(.text+0x2cc4): undefined reference to`ctallowdeny::~ctallowdeny()''collect2: ld returned 1 exit statusmake[2]: *** [kcron] Error 1make[2]: Leaving directory `/home/ubuntu/Desktop/kdeadmin-3.5.5/kcron''make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/ubuntu/Desktop/kdeadmin-3.5.5''make: *** [all] Error 2ubuntu@ubuntu-desktop:~/Desktop/kdeadmin-3.5.5//////////////////////////////////////////////////////////////////////Any ideas ? - I have been stuck on this for several hours :(Yes, a missing semicolon after the class definition in the .h file.HTH,- J. 这篇关于卡住了头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-06 07:23