kdev 4 build error: undefined ref to...
Hi all,
my problem is that when I compile my project KDevelop4 gives me the following error:
1 2 3 4 5 6 7 8 9 10
|
/home/yours3lf/projects/proba2/build> make
[ 50%] Built target loopclass
Linking CXX executable proba2
CMakeFiles/proba2.dir/main.cpp.o: In function `main':
/home/yours3lf/projects/proba2/main.cpp:7: undefined reference to 'loopclass::start()'
collect2: ld returned 1 exit status
make[2]: *** [proba2] Error 1
make[1]: *** [CMakeFiles/proba2.dir/all] Error 2
make: *** [all] Error 2
*** Failed ***
|
my main.cpp
1 2 3 4 5 6 7 8 9 10
|
#include "loopclass.h"
int main(int argc, char* args[])
{
loopclass lp;
lp.start();
return 0;
}
|
loopclass.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#ifndef loopclass_h
#define loopclass_h
#include <iostream>
class loopclass
{
protected:
public:
void start();
bool running;
loopclass() : running(true){}
~loopclass(){}
};
#endif
|
loopclass.cpp
1 2 3 4 5 6 7 8 9 10 11
|
#include "loopclass.h"
void loopclass::start()
{
while(running)
{
}
}
|
CMakeLists.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#cmake ver req
cmake_minimum_required(VERSION 2.6)
#project name
project(proba2)
#dependencies
include_directories(/usr/include/)
#header files
include_directories("${CMAKE_SOURCE_DIR}")
add_library(loopclass loopclass.h loopclass.cpp)
#adding the exe
add_executable(proba2 main)
|
please help,
Yours3lf
From the looks of it, I'd say your main executable is not linking with loopclass.o (or with the library it
is contained in).
ok, but then what do i have to change in the cmakelists.txt, because i guess the crack in the app is there...
Topic archived. No new replies allowed.