I'm using eclipse Junior and build my C++ program.
the command line in the console is as following:
make all
Building file: ../src/misc/bt_misc.cpp
Invoking: GCC C++ Compiler
g++ -DNDEBUG=1 -DEPOLL=1 -D__GXX_EXPERIMENTAL_CXX0X__
-I"/home/adtech/workspace/mtracker/src/misc" -I"/home/adtech/workspace/mtracker/src/Tracker" -I"/home/adtech/workspace/mtracker/src/misc/xbt" -I/usr/include -I/usr/lib64/mysql -O0 -g3 -Wall -c -fmessage-length=0 -std=c++0x -MMD -MP -MF"src/misc/bt_misc.d" -MT"src/misc/bt_misc.d" -o "src/misc/bt_misc.o" "../src/misc/bt_misc.cpp"
I got no error during the compilation phase, unfortunately, encouter an error at the end as following:
make: *** [src/Tracker/server.o] Error 1
Could you guys help me explain this error. Thanks so much
That error means that a command it executed (presumably g++ when building server.o) encountered an error. Scroll up and make sure there aren't any errors. The error might not be at the very end if you're running multiple jobs in parallel.
Related
I use a Linux environment for code development and testing of a program and now I want to compile an Windows ".exe" file so that my program can run on Windows OS, after some internet research I tried to modified my makefile to use x86_64-w64-mingw32-g++ instead of g++ as its compiler but now I get a segmentation fault at the end of the compilation and I am not sure how to debug this. My makefile is below:
PROGRAM=output.exe
COMPILER=x86_64-w64-mingw32-g++
# PROGRAM=output
# COMPILER=g++
#BIN_FOLDER=bin
DEPS += Defs.h Structs.h
CXXFLAGS+=`sdl2-config --cflags`
CXXFLAGS+=-DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\"
CXXFLAGS+=-Wall -Wempty-body -Werror -Werror=maybe-uninitialized -Warray-bounds
CXXFLAGS+=-g -lefence -std=c++20 -fopenmp
LDFLAGS+=-L/usr/local/lib -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf -fopenmp src/ECS/*.cpp #-pg
FILENAME:= $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
$(PROGRAM):$(FILENAME)
$(COMPILER) $(FILENAME) -o $# $(LDFLAGS)
clean:
rm src/*.o
this compiles without a problem in g++ but when using the mingw32 compiler I get this error:
x86_64-w64-mingw32-g++ src/ActionManager.o src/AStar.o ...[a bunch of .o files] -o output.exe
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped
compilation terminated.
make: *** [makefile:26: output.exe] Error 1
I tried compiling a simple helloWorld.cpp program using x86_64-w64-mingw32-g++ like this: x86_64-w64-mingw32-g++ 01_hello_world.c -o windowshello.exe and that works fine.
I also tried deleting all my LDFLAGS just to see what would happen and I get the same result.
Could anyone point me into the right direction as to how I might debug this? Is this a particular part of my code that is causing this or am I going about this entirely wrong?
I'm currently working on this project. I'm using cxxopts.hpp in order to parse cli options but since I added it I get some error that I now list how to reproduce:
Build the project
$ meson build
$ cd build
$ ninja
Everything good so far, it builds without any errors.
I can change anything other than test/vector.cpp and test/random.cpp (that are the places where I'm using cxxopts.hpp) and build with ninja without any problems.
Then when I edit test/vector.cpp or test/random.cpp and do ninja these error appears:
[1/4] Compiling C++ object test/random.p/random.cpp.o
FAILED: test/random.p/random.cpp.o
c++ -Itest/random.p -Itest -I../test -I../include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -O0 -g -MD -MQ test/random.p/random.cpp.o -MF test/random.p/random.cpp.o.d -o test/random.p/random.cpp.o -c ../test/random.cpp
In file included from ../include/cxxopts.hpp:43,
from ../test/random.cpp:6:
test/vector:1:1: error: stray ‘\177’ in program
1 | <U+007F>ELF<U+0002><U+0001><U+0001><U+0003><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0003><U+0000>><U+0000><U+0001><U+0000><U+0000><U+0000> F<U+0000><U+0000><U+0000><U+0000><U+0000><U+0000>#<U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><90><91><U+0015><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000>#<U+0000>8<U+0000><U+000D><U+0000>#<U+0000>(<U+0000>'<U+0000><U+0006><U+0000><U+0000><U+0000><U+0004><U+0000><U+0000><U+0000>#<U+0000><U+0000><U+0000><U+0000><U+0000><U+0000><U+0000>#<U+0000><U+0000><U+0000><U+0000>...
(a very lengthy error up to 400 MB in a file)
Any idea on how to fix this or why this happens in the first place?
As pointed out by #KamilCuk in their comment, this error emerged from a name collision between the standard library #include <vector> and the binary vector I was creating from vector.cpp.
Changing the name of my binary solves the issue.
EDIT:
The desired behavior can be also achieved by setting the option implicit_include_directories to false like this:
vector = executable('vector', 'vector.cpp', include_directories: incdir, implicit_include_directories: false)
I am working on simple program of grayscaling using Opencl. When i compile, it gives me the following error.
make all
Building file: ../Test1.cpp
Invoking: GCC C++ Compiler 4.9.3 [armeb-linux-gnueabihf]
armeb-linux-gnueabihf-g++ -I/opt/AMDAPPSDK-3.0-0-Beta/include/ -I/opt/AMDAPPSDK-3.0-0-Beta/include/CL -I/opt/AMDAPPSDK-3.0-0-Beta/include/GL -I/opt/AMDAPPSDK-3.0-0-Beta/include/SDKUtil -I/usr/local/include -O0 -g3 -Wall -c -fmessage-length=0 -o -MM -MMD -MP -MF"Test1.d" -MT"Test1.d" -o "Test1.o" "../Test1.cpp"
cc1plus: fatal error: Test1.d: No such file or directory
compilation terminated.
make: *** [Test1.o] Error 1
Compiler command with options:-
armeb-linux-gnueabihf-g++ -I/opt/AMDAPPSDK-3.0-0-Beta/include/ -I/opt/AMDAPPSDK-3.0-0-Beta/include/CL -I/opt/AMDAPPSDK-3.0-0-Beta/include/GL -I/opt/AMDAPPSDK-3.0-0-Beta/include/SDKUtil -I/usr/local/include -O0 -g3 -Wall -c -fmessage-length=0 -o -MM
The actual command that is executed seems to have the output option -o twice. This option is supposed to be followed by a filename.
Please remove the output option -o from your command because eclipse seems to automatically add it.
I am using Netbeans for my C++ project. I compiled my program using make and ran into this error:
collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped
Makefile:4: recipe for target 'barn' failed
make: *** [barn] Error 1
Whereas, when I compiled it in a linux environment(Ubuntu to be precise), it compiled fine. What could have possibly gone wrong?
This is what I got when I typed make -n:
g++ -c main.cc
g++ -c Animal.cc
g++ -c Bird.cc
g++ -c Chicken.cc
g++ -c Cat.cc
g++ -c Pig.cc
g++ -o barn main.o Animal.o Bird.o Chicken.o Cat.o Pig.o Random.o
PS I prefer using Netbeans
A segment fault in the linker suggests a bug with that. This is what I would try if I were to run into this problem.
At the command line do
g++ -o barn main.cc Animal.cc Bird.cc Chicken.cc Cat.cc Pig.cc Random.cc
If that does not work, try variations like:
g++ -o barn main.cc Pig.cc Random.cc Animal.cc Bird.cc Chicken.cc Cat.cc
The order should not matter. This is just the kind of thing I would try with a mystery-meat problem like this.
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.