Error while building an eclipse project with boost - c++

I am trying to include boost in building C++ projects on Ubuntu. The g++ version is 4.8.1 and the boost version is 1.57.0. I followed these instructions to use boost (header only libraries). I put the boost library into ~/opt/lib, and when I try to compile the project I get the following error output:
15:19:47 **** Incremental Build of configuration Debug for project TEST ****
make all
Building file: ../src/test.cpp
Invoking: GCC C++ Compiler
g++ -include/home/alexander/opt/lib/boost_1_57_0 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o "src/test.o" "../src/test.cpp"
In file included from <command-line>:0:0:
/usr/include/stdc-predef.h:39:1: fatal error: /home/alexander/opt/lib/boost_1_57_0: No such file or directory
#endif
^
compilation terminated.
make: *** [src/test.o] Error 1
15:19:48 Build Finished (took 1s.31ms)
What have I made wrong?

Related

How to include a library header after adding the linker in Eclipse

I am trying to include a library from Github (https://github.com/dcjones/hat-trie).
The installation worked fine and I was able to add the library
to the linker in Eclipse
but the problem is that I don't know how to use it.
I have added it as a header
#include <hat-trie.h>
but it's giving this error:
18:49:31 **** Incremental Build of configuration Debug for project test2 ****
make all
Building file: ../src/test2.cpp
Invoking: GCC C++ Compiler
g++ -std=c++1y -std=c++11 -I/home/use1/boost_1_58_0 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test2.d" -MT"src/test2.d" -o "src/test2.o" "../src/test2.cpp"
**../src/test2.cpp:28:22: fatal error: hat-trie.h: No such file or directory
#include <hat-trie.h>**
^
compilation terminated.
make: *** [src/test2.o] Error 1
18:49:33 Build Finished (took 2s.831ms)
Any idea how can I fix this?

Eclipse CDT Cygwin error

i have a problem with eclipse CDT and cygwin, when i try to build a simple hello world project i have this error:
make all
Building file: ../src/test.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o "src/test.o" "../src/test.cpp"
C:\shell.w32-ix86\make.exe: *** [src/test.o] Error 1
14:37:48 Build Finished (took 178ms)
Cygwin is in the path and commands like 'g++' or 'make' works fine.
Thank in advance for your help.
Follow this tutorial to properly set up cygwin with Eclipse CDI. After completing all the steps, add one more path dependency on: Project Properties -> C/C++ General -> Paths and Symbols -> Includes GNU C++ with the value to : ${CYGWIN_HOME}/usr/i686-pc-cygwin/sys-root/usr/bin. This solved all the issues arising on Eclipse CDT with CYGWIN.

Using -mfloat-abi=hard in eclipse

I am trying to cross compile in eclipse using the arm gcc compiler. I go to projrct , properties and set the c/c++ compile option and set the flag to -mfloat-abi=hard.
It throws the following exception while building:
**** Build of configuration Debug for project HelloWorld ****
make all
Building file: ../src/HelloWorld.c
Invoking: GCC C Compiler
arm-linux-gnueabi-gcc -I/usr/arm-linux-gnueabi/include -O0 -g3 -Wall -mfloat-abi=hard -c -fmessage-length=0 -MMD -MP -MF"src/HelloWorld.d" -MT"src/HelloWorld.d" -o "src/HelloWorld.o" "../src/HelloWorld.c"
Finished building: ../src/HelloWorld.c
Building target: HelloWorld
Invoking: GCC C Linker
arm-linux-gnueabi-gcc -L/usr/arm-linux-gnueabi/lib -mfloat-abi=hard -o "HelloWorld" ./src/HelloWorld.o
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: error: ./src/HelloWorld.o uses VFP register arguments, HelloWorld does not
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: failed to merge target specific data of file ./src/HelloWorld.o
collect2: ld returned 1 exit status
make: *** [HelloWorld] Error 1
**** Build Finished ****
It builds fine without that flag. But I need to set it for it to run on the beaglebone.Any ideas what I am doing wrong?
Output after using -print-multi-lib
**** Build of configuration Debug for project HelloWorld ****
make all
Building file: ../src/HelloWorld.c
Invoking: GCC C Compiler
arm-linux-gnueabi-gcc -I/usr/arm-linux-gnueabi/include -O0 -g3 -Wall -mfloat-abi=hard -c -fmessage-length=0 -print-multi-lib -MMD -MP -MF"src/HelloWorld.d" -MT"src/HelloWorld.d" -o "src/HelloWorld.o" "../src/HelloWorld.c"
arm-linux-gnueabi-gcc: error: ./src/HelloWorld.o: No such file or directory
.;
arm-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
make: *** [HelloWorld] Error 4
.;#mfloat-abi=softfp
hf;#mfloat-abi=hard
Finished building: ../src/HelloWorld.c
Building target: HelloWorld
Invoking: GCC C Linker
arm-linux-gnueabi-gcc -L/usr/arm-linux-gnueabi/lib -mfloat-abi=hard -o "HelloWorld" ./src/HelloWorld.o
**** Build Finished ****

problem building cpp project in eclipse

I have installed minGW and msys. In eclipse CDT I created c++ project that uses cross gcc toolchain.
Eclipse created make file which I can use through command line, so if I run make all project is correctly compiled, but if I use eclipse to build, it fails with following message
**** Build of configuration Debug for project cpp ****
make all
Building file: ../src/main.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.cpp"
make: *** [src/main.o] Error 1
**** Build Finished ****
I have chosen wrong toolchain in project, changed to mingw gcc and now it works

Eclipse problem in windows

Hello I am getting the following error when trying to compile a c++ project under Eclipse Indigo in windows:
mingw32-make all
'Building file: ../src/testing.cpp'
'Invoking: GCC C++ Compiler'
g++ -I"c:\MinGW\lib\gcc\mingw32\4.5.0\include\c++\tr1\" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/ testing.d" -MT"src/testing.d" -o "src/testing.o" "../src/testing.cpp"
g++: no input files
mingw32-make: *** [src/testing.o] Error 1
What could be the problem?
There must be some extra spaces somewhere before the name of the file, because you have a very strange file name in the arguments:
-MF"src/ testing.d"
Should be
-MF"src/testing.d"
The wrong path somehow must break the compile line and g++ doesn't understand what the input file is.