Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » how to get compiler to find library?(compiler can not find library )
how to get compiler to find library? [message #1847007] Tue, 12 October 2021 01:57 Go to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
using eclipse Version: 2018-09 (4.9.0)
on kubuntu 16 (i think)
i have tried usr/include/qt4 and usr/include/qt4/QtGui
usr/include/qt4 did not throw an error in all spots shown, but usr/include/qt4/QtGui caused an error in compiler -> includes -> (`include)

the compiler can not find what i can.
how to get compiler to find library?


//******************* edit *********************
i added qt4 under compiler -> includes -> (`include)
i get:
g++ -std=gnu++11 -std=c++11 -lusr/include/qt4 -Iusr/include/qt4 -includeqt4 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"CComPort.d" -MT"CComPort.o" -o "CComPort.o" "../CComPort.cpp"
cc1plus: fatal error: qt4: No such file or directory

guessing that (`include) is usr/include/

//*******************edit***********************
i commented out #include <QtGui>, and #include <QApplication>, throws the same error.
QApplication is a file in QtGui directory.

what am i doing wrong?

[Updated on: Wed, 13 October 2021 02:34]

Report message to a moderator

Re: how to get compiler to find library? [message #1847087 is a reply to message #1847007] Thu, 14 October 2021 09:28 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
I think you meant /usr/... and not usr/...
The first is relative to the main system directory
while the second is relative to the current directory
which is the Debug directory in your project when building.

It's unlikely the libraries for Qt would be in /usr/include
which is used for header files. The libraries are usually in a
directory beginning /usr/lib... or /usr/local/lib...

Where exactly depends on how you got them.
If you downloaded Qt as a package you may be able to
get the compile and link flags using pkg-config.

All of this is off-topic for this forum. You really should be asking
at a site devoted to Qt or places that cater to programming
questions such as stackoverflow.com
Re: how to get compiler to find library? [message #1847113 is a reply to message #1847087] Fri, 15 October 2021 01:59 Go to previous messageGo to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
thank you for your help.
the question i have about your reply, how is a programming question with eclipse off topic in an eclipse forum?
Re: how to get compiler to find library? [message #1847115 is a reply to message #1847087] Fri, 15 October 2021 02:07 Go to previous messageGo to next message
michael bridges is currently offline michael bridgesFriend
Messages: 9
Registered: September 2021
Junior Member
David Vavra wrote on Thu, 14 October 2021 09:28
I think you meant /usr/... and not usr/...
The first is relative to the main system directory
while the second is relative to the current directory
which is the Debug directory in your project when building.

It's unlikely the libraries for Qt would be in /usr/include
which is used for header files. The libraries are usually in a
directory beginning /usr/lib... or /usr/local/lib...


ty
ty
ty
ty
ty
that little / was the bug
Re: how to get compiler to find library? [message #1847141 is a reply to message #1847115] Fri, 15 October 2021 16:04 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
the question i have about your reply, how is a programming question with eclipse off topic in an eclipse forum


This forum is for dealing with issues caused by Eclipse/CDT or how to set it
up in general (menus to use, etc) such as: How do I get CDT to tell the compiler
where my headers are?
. It's not for fixing your projects. You apparently
already know how to set it up and seem to be asking for details specific
to your project such as Why don't my setting values work?.
Re: how to get compiler to find library? [message #1847159 is a reply to message #1847141] Sat, 16 October 2021 18:00 Go to previous messageGo to next message
Anne Ranch is currently offline Anne RanchFriend
Messages: 85
Registered: October 2020
Member
Since I have a SAME issue - linking to a library I feel this is a right place / time to hijack this thread .
If this is not correct forum to ask it will save administrators some time - just repeat the excises already posted.

If I set CDT and it does not perform as expected I should be able to use this forum as tool of MY choosing .
If it is NOT , in others view (!) , proper to use this forum I'll move on to where I can get real help.

Here is an abbreviated copy on MY "link to library " issue.


qw@qw-desktop:~$ whereis libc
libc: /usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/libc.a /usr/share/man/man7/libc.7.gz
qw@qw-desktop:~$

COLLECT_GCC_OPTIONS='-L/usr/lib/x86_64-linux-gnu' '-v' '-o' 'ESA_BASE'

'rm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/crtend.o /home/qw/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/crtn.o
/home/qw/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -llibc
/home/qw/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for -lm
/home/qw/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make: *** [makefile:63: ESA_BASE] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

12:23:13 Build Failed. 4 errors, 0 warnings. (took 797ms)

I have found "libc" (whereis) and added to project setting , including path.

The linker (?) output
has reported correct path - COLLECT_GCC_OPTIONS='-L/usr/lib/x86_64-linux-gnu' '
but it cannot t find the "libc"

So is this CDT problem or am I missing something ?

My apology to the original poster for hijacking his thread .
Re: how to get compiler to find library? [message #1847160 is a reply to message #1847159] Sat, 16 October 2021 18:24 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Anne - please ...

Using a stand-alone arm-linux compiler is NOT the way to create Raspbian programs.

Please get the Raspbian toolset from https://github.com/raspberrypi/tools. It contains the correct linkages between the compiler, linker and libraries.


--

Tauno Voipio
Re: how to get compiler to find library? [message #1847161 is a reply to message #1847160] Sun, 17 October 2021 00:12 Go to previous messageGo to next message
Anne Ranch is currently offline Anne RanchFriend
Messages: 85
Registered: October 2020
Member
a. Can you comment on why CDT cannot find the library and terminal "whereis" can ?
b. before you RTFM at least check the link

Thanks for your support.
CASE CLOSED
Re: how to get compiler to find library? [message #1847162 is a reply to message #1847161] Sun, 17 October 2021 03:46 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
Can you comment on why CDT cannot find the library


You've been told many times: CDT has no idea what you are
trying to accomplish. It takes what you've told it and passes it
on to the compiler and ONLY when it is generating a makefile.

If it passes along incorrect information that is because you
gave it incorrect information.
Previous Topic:Standalone debugger doesn't work
Next Topic:Troubleshoot #define macros
Goto Forum:
  


Current Time: Thu Apr 25 23:16:57 GMT 2024

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

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

Back to the top