Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » configuering eclipse c++ for HDF libraries
configuering eclipse c++ for HDF libraries [message #1803781] Sat, 09 March 2019 12:41 Go to next message
Siliang Liu is currently offline Siliang LiuFriend
Messages: 2
Registered: March 2019
Junior Member
Hi everyone,

I have met a problem with configuering eclipse c++ for HDF libraries. The include and libraries path has been specified, the lib name has been added as attched.

Errors pompt out when executing a read hdf example file as below. Any help? Thanks.

19:45:53 **** Incremental Build of configuration Debug for project
ReadWriteHDF5 ****
make all
Building target: ReadWriteHDF5
Invoking: GCC C++ Linker
g++ -L/usr/local/lib/hdf5-1.10.4/lib -o "ReadWriteHDF5"
./src/ReadWriteHDF5.o -l/usr/local/lib/hdf5-1.10.4/lib/libhdf5_hl_cpp.so
-l/usr/local/lib/hdf5-1.10.4/lib/libhdf5_cpp.so
-l/usr/local/lib/hdf5-1.10.4/lib/libhdf5.so
/usr/bin/ld: cannot find -l/usr/local/lib/hdf5-1.10.4/lib/libhdf5_hl_cpp.so
makefile:45: recipe for target 'ReadWriteHDF5' failed
/usr/bin/ld: cannot find -l/usr/local/lib/hdf5-1.10.4/lib/libhdf5_cpp.so
/usr/bin/ld: cannot find -l/usr/local/lib/hdf5-1.10.4/lib/libhdf5.so
collect2: error: ld returned 1 exit status
make: *** [ReadWriteHDF5] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

19:45:54 Build Failed. 5 errors, 0 warnings. (took 271ms)
Re: configuering eclipse c++ for HDF libraries [message #1803955 is a reply to message #1803781] Thu, 14 March 2019 09:24 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Eclipse expects you to understand how to use the tools it calls.
The GNU Toolchain is one such set.

The GNU linker is named ld and is packaged with binutils
The latest online documentation for binutils is at https://sourceware.org/binutils/docs-2.32/
The documentation for ld is at https://sourceware.org/binutils/docs-2.32/ld/index.html
The command line options for ld are at https://sourceware.org/binutils/docs-2.32/ld/Options.html#Options
Scroll down to -l and -L

Eclipse doesn't call ld directly but uses g++ instead.
The only real difference is that some linker options must be used with -Wl,<ld option>

The command line option for the linker,-lXXX, is shorthand for libXXX.<a or so> with .so preferred if both can be found.
The linker will search the library path search list for the libraries.
-L<path> prepends <path> to the search list.

You set these using Eclipse/CDT with
Project --> Properties --> C/C++ Build --> Settings --> Tool Settings tab --> GCC C++ Linker --> Libraries dialog.

You already have -L<path> set so you need to remove the -l<path>lib from the library names.
For example, -lhdf5_hl_cpp for /usr/local/lib/hdf5-1.10.4/lib/libhdf5_hl_cpp.so

Alternately, you can specify the library directly using
Project --> Properties --> C/C++ Build --> Settings --> Tool Settings tab --> GCC C++ Linker --> Miscellaneous dialog as Other Objects.
You should include the complete path name for the library when using this.
In which case, you should drop the -l from the name.

HTH





[Updated on: Thu, 14 March 2019 09:34]

Report message to a moderator

Previous Topic:CLion and the CmakeList.txt
Next Topic:libhdf5.so.103: cannot open shared object file
Goto Forum:
  


Current Time: Thu Apr 25 16:30:32 GMT 2024

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

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

Back to the top