KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a C++ project in Eclipse CDT which uses some functions from OpevCV and it compiles into an executable and works fine. Now I want to have a new C++ project which uses some of the functions defined in the first one. I can't get the two to compile and link together. I have #include "..." in the relevant files in the new project, I've added the old project to the referenced projects of the new project and in the build settings of the new project, I've added the source folder of the old project as an include ( -I gcc option). I've attached a screenshot of my Eclipse in case it's helpful: The error given by the compiler is: Building target: OtherProject Invoking: GCC C++ Linker g++ -o "OtherProject" ./src/foo.o ./src/foo.o: In function `main': /home/max/opencvjni/OtherProject/Debug/../src/foo.cpp:13: undefined reference to threshold()' collect2: ld returned 1 exit status make: *** [OtherProject] Error 1 Here is the code in those other files in the other tabs of the screenshot: Threshold.cpp #include <cv.h> #include <highgui.h> #include "Threshold.h" using namespace cv; int threshold(void) { Mat img = imread("/home/max/opencvjni/monalisa.jpg", 0); threshold(img, img, 127, 255, THRESH_BINARY); imwrite("/home/max/opencvjni/monathresh.jpg", img); return 0; } int main(void) { threshold(); return 0; } Threshold.h #ifndef THRESHOLD_H_ #define THRESHOLD_H_ int threshold(void); #endif /* THRESHOLD_H_ */[/code] Eclipse version: 3.7.2 CDT version: 8.0.2.201202111925 OS: Ubuntu 12.04 Thank you for looking at my post, if there is no way to do this, or it is just more sensible t
Tags (comma-separated)
Save Edits
Cancel