include from not current project [message #1820629] |
Thu, 23 January 2020 22:10  |
Eclipse User |
|
|
|
I hope I can explain this as PLAIN C++ problem.
It should be OK with Eclipse to "include" source from another project.
The idea is to have ONE place to edit (a class ) and use it independently ,
no "relations" whatsoever in other projects.
I use simple "properties .. settings .. include path ".
It shows up in
project -> includes (see attaches screen shot )
it complies . links but
show up as "undefined reference".
The icon attached to "include RPI_BT_COMMON..." has (!) and the text is grayed .
Obviously no good, but...
I cannot figure out what is wrong , what am I missing OR is "include" from another project no good.
Is including source not enough ( but it complies ) ?
Do I need to make a library and link it to my project ?
|
|
|
|
|
|
Re: include from not current project [message #1820677 is a reply to message #1820672] |
Sat, 25 January 2020 21:19   |
Eclipse User |
|
|
|
OK, I realized that I need to build a library project for the common classes. .
The resulting library full name is "libRPI_BT_LIB.a"
Its path (_L) is in linker libraries option and can be seen in linker output ,
its line (-l) is also in same option and seen in linker output
BUT
the library cannot be found
It LOOKS as linker is looking in wrong place for it .
What am I missing ??
I did try "-llibRPI_BT_LIB.a" with same result
I am hoping enclosing full linker output may help to idetify the issue.
19:58:09 **** Incremental Build of configuration Debug for project PROJECT_A ****
make all
Building target: PROJECT_A
Invoking: GCC C++ Linker
g++ -L/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2019-12/Eclipse_2019_12/eclipse/Workspace_2019_12/RPI_BT_LIB -v -o "PROJECT_A" ./src/M_SOCKET_COMMON/CSOCKETCOMMON.o ./src/PROJECT_A.o -lRPI_BT_LIB
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-L/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2019-12/Eclipse_2019_12/eclipse/Workspace_2019_12/RPI_BT_LIB' '-v' '-o' 'PROJECT_A' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc5WkMUt.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o PROJECT_A /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2019-12/Eclipse_2019_12/eclipse/Workspace_2019_12/RPI_BT_LIB -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. ./src/M_SOCKET_COMMON/CSOCKETCOMMON.o ./src/PROJECT_A.o -lRPI_BT_LIB -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lRPI_BT_LIB
collect2: error: ld returned 1 exit status
make: *** [PROJECT_A] Error 1
makefile:46: recipe for target 'PROJECT_A' failed
"make all" terminated with exit code 2. Build might be incomplete.
19:58:10 Build Failed. 3 errors, 0 warnings. (took 845ms)
[Updated on: Sat, 25 January 2020 21:21] by Moderator
|
|
|
|
Re: include from not current project [message #1820687 is a reply to message #1820685] |
Sun, 26 January 2020 10:26  |
Eclipse User |
|
|
|
UPDATE
I have build a test library using ALL DEFAULTS.
IDE build shared library so I had to option for "PIC"
Adding (-l) produced expected " cannot find ..."
Adding (-L) path INCLUDING /Debug subdirectory SOLVED the problem.
Moral of the story - check the actual FULL path to the library.
DILEMMA
Make sure the (-L) is changed in release.
PS I did not see David's last note in time to fix this.
|
|
|
Powered by
FUDForum. Page generated in 0.09747 seconds