Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » GCC C++ Compiler can't find include directory
GCC C++ Compiler can't find include directory [message #1774117] Tue, 10 October 2017 17:49 Go to next message
Rick Blacker is currently offline Rick BlackerFriend
Messages: 14
Registered: August 2016
Junior Member
OS - Ubuntu 16.04
Eclipse - Oxygen
3rd party include - OpenCV

Hi all. Pretty new to Eclipse and C++. I'm trying to get a project setup correctly. I have installed OpenCV into /home/rick/opencv.

I have two include folders
/home/rick/opencv/include/opencv
/home/rick/opencv/include/opencv2


In Eclipse, I went to Project->Properties->C/C++ Build->Settings->Tool Settings Tab->Includes.

From there I clicked on the "Add" button, used the "File System" button to go choose my include folder. Clicked ok and the path was added to the "Include paths" section.

I try to build project and I get this error.


Quote:
make all
Building file: ../src/first.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include -I/home/rick/opencv/include/opencv -I/home/rick/opencv/include/opencv2 -include/home/rick/opencv/include/opencv2/opencv.hpp -O0 -g3 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"src/first.d" -MT"src/first.o" -o "src/first.o" "../src/first.cpp"
Finished building: ../src/first.cpp

Building target: FirstOCV
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "FirstOCV" ./src/first.o -l/home/rick/opencv/include/opencv2
/usr/bin/ld: cannot find -l/home/rick/opencv/include/opencv2
makefile:45: recipe for target 'FirstOCV' failed
collect2: error: ld returned 1 exit status
make: *** [FirstOCV] Error 1



Was hoping that someone might be able to help me figure out why the IDE itself can see the path, but the compiler itself can't.
Thanks all!!


Re: GCC C++ Compiler can't find include directory [message #1774136 is a reply to message #1774117] Tue, 10 October 2017 22:21 Go to previous message
Andrey Solovjev is currently offline Andrey SolovjevFriend
Messages: 7
Registered: December 2014
Location: Moscow
Junior Member
The phase of compilation finished without error:
Finished building: ../src/first.cpp
The error is in linked phase. The option -l/home/rick/opencv/include/opencv2 means that you try to link library file /home/rick/opencv/include/opencv2. If you need some library to be linked use GCC C++ Linker -> Libraries ->Library search path to add folder name and GCC C++ Linker -> Libraries ->Libraries to add library name without prefix "lib" and suffix ".a".

[edited]
If opencv2 is not a library delete it from linked options. If it is an include directory add it to the compilation options. May be reason that here is used option -l instead of -I. First case is smal l (link) and second one is capital I (Include)

[Updated on: Tue, 10 October 2017 22:29]

Report message to a moderator

Previous Topic:Add files from linked folders to SVN repository
Next Topic:Arduino C++ IDE: Upload succeeds, console shell fails
Goto Forum:
  


Current Time: Sat Dec 16 20:38:08 GMT 2017

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

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