This forum has been archived. All content is frozen. Please use KDE Discuss instead.

kDevelop doesn't compile projects divided into several files

Tags: kdevelop, build, projects, compilation, buildsystem kdevelop, build, projects, compilation, buildsystem kdevelop, build, projects, compilation, buildsystem
(comma "," separated)
User avatar
transient
Registered Member
Posts
3
Karma
0
OS
Hello everyone.

I couldn't find any official kDevelop forum (is there any?), so I came to conclusion, that I'll post my problem in here.

It seems that my kDevelop installation has got a problem with compiling projects, that are composed of more than one file.

Just to show you the easiest example, let's say that I have got three such files:

main.cpp:
Code: Select all
#include "header.hpp"
int variable1 = 4;
int main(int argc, char **argv)
{
    cout << (variable1 + variable2) << endl;
    return 0;
}


second.cpp:
Code: Select all
#include "header.hpp"
int variable2 = 9;


header.hpp:
Code: Select all
#ifndef HEADER_HPP_
#define HEADER_HPP_

#include <iostream>

using namespace std;

extern int variable1;
extern int variable2;


#endif /* HEADER_HPP_ */


When I tries to build that project in kDevelop, I receive such communicates:

Linking CXX executable projj
CMakeFiles/projj.dir/main.cpp.o: In function `main':
/home/mateusz/projekty/projj/main.cpp:5: undefined reference to `variable2'
collect2: ld returned 1 exit status
make[2]: *** [projj] Error 1
make[1]: *** [CMakeFiles/projj.dir/all] Error 2
make: *** [all] Error 2
*** Failed ***


Obviously, it doesn't happen when I use eclipse or netbeans.
Does anyone know, what can cause it?

Thank you in advance for your help.

Best Regards.

PS. I hope I posted it in a right place. If I didn't, let me know before removing it ;)

EDIT: Problem solved. It turned out, that kDevelop doesn't write build system automatically. Since I use cmake, all I had to do was to change Cmakelist.txt . I'm writing this, because someone may encounter similar problem I did.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell