Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » need help with g++ linker and opencv(I am able to cross compile an opencv program using a console but i can't do it in eclipse)
need help with g++ linker and opencv [message #1782062] Fri, 16 February 2018 16:35 Go to next message
Guillaume Bergeron is currently offline Guillaume BergeronFriend
Messages: 3
Registered: February 2018
Junior Member
Hello everyone, this topic has probably been answered but I couldn't find anything due to my lack of knowledge in the subject so im asking for help to solve my issue. I can cross compile a program (test.cpp) that uses opencv for my raspberry pi using this command in the console
arm-linux-gnueabihf-g++ -o test3 test.cpp `pkg-config opencv --cflags --libs`
. But when I try to do it in eclipse, it gives me this output
16:30:21 **** Incremental Build of configuration Debug for project z ****
make all 
Building file: ../test.cpp
Invoking: Cross G++ Compiler
arm-linux-gnueabihf-g++ -I/home/gbergeron -I/home/gbergeron/build/install/include/opencv -I/home/gbergeron/build/install/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.o" -o "test.o" "../test.cpp"
Finished building: ../test.cpp
 
Building target: z
Invoking: Cross G++ Linker
arm-linux-gnueabihf-g++ -L/home/gbergeron/build/install/lib -o "z"  ./test.o   -lopencv_dnn -lopencv_ml -lopencv_objdetect -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_imgproc -lopencv_flann -lopencv_core
./test.o: In function `main':
/home/gbergeron/workspaceRPI/z/Debug/../test.cpp:3: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
makefile:44: recipe for target 'z' failed
/home/gbergeron/workspaceRPI/z/Debug/../test.cpp:4: undefined reference to `cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/home/gbergeron/workspaceRPI/z/Debug/../test.cpp:5: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
/home/gbergeron/workspaceRPI/z/Debug/../test.cpp:5: undefined reference to `cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
collect2: error: ld returned 1 exit status
make: *** [z] Error 1

16:30:23 Build Finished (took 2s.229ms)



I have linked the required libraries in the setting (cross g++ linker) but it just won't work.

Any help is really appreciated im still noob at this =)
  • Attachment: Capture.PNG
    (Size: 89.88KB, Downloaded 20 times)
Re: need help with g++ linker and opencv [message #1782262 is a reply to message #1782062] Wed, 21 February 2018 04:51 Go to previous message
David VavraFriend
Messages: 772
Registered: October 2012
Senior Member
Ths doesn't have anything to do with CDT
This: http://answers.opencv.org/question/122936/library-to-link-for-imread/
says which lib has it depends upon version and compiler.

You may want to verify that the version pkg-config is referencing is he one for the target.
You can also use the nm utility in Linux to list all of the symbols in each library to find out if
the one for cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) is among them.
It may not have been implemented.

Questions about how to link opencv for your target would be better addressed at a forum
dedicated to that or perhaps stackoverflow.com





[Updated on: Wed, 21 February 2018 04:52]

Report message to a moderator

Previous Topic:CDT + Cmake for Cross Dev, symbols not resolved
Next Topic: STRICT_EXPECTED_CALL(mallocAndStrcpy_s(IGNORED_PTR_ARG, config)) .IgnoreArgument(1); #524
Goto Forum:
  


Current Time: Wed Sep 19 02:49:26 GMT 2018

Powered by FUDForum. Page generated in 0.01463 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top