g++ won't play nice with wx-config - c++

I'm on windows using mingw and when i use the following to try and compile my wxWidgets code
g++ main.cpp `wx-config --libs` `wx-config --cxxflags`
I get the following error
g++: `wx-config: No such file or directory
g++: `wx-config: No such file or directory
cc1plus.exe: error: unrecognized command line option "-flibs`"
cc1plus.exe: error: unrecognized command line option "-fcxxflags`"
And I cannot figure out what to do to make g++ play nice with wx-config
Please help, thanks.

What shell are you using? Back quotes don't work on the Windows command prompt. You may need to use msys and bash.

Related

g++ error unrecognized command line option -mwindows

I am trying to create a c++ application with a graphical interface and thus I am trying to Implement OpenGL with SDL. I am working on a Ubuntu Subsystem for Windows 10. I already installed the sdl and gl libraries but now when I am compiling my code with
g++ -o glpractice glpractice.cpp -Wall $(sdl-confiig --cflags --libs) $(pkgconf gl --libs)
it returns the error
g++: error: unrecognized command line option '-mwindows'
How do I fix that or work around it?

MINGW, Code::Blocks - No such file or directory error when compiling c++

When I try to compile C++ programm in Code::blocks it gives me this error:
-------------- Build: Debug in elcounter (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Weffc++ -Wall -std=c++14 -fexceptions -Weffc++ -std=c++14 -g -I"C:\Users\Zahir\Box Sync\CPP projects\September_2k16\elcounter\" -c "C:\Users\Zahir\Box Sync\CPP projects\September_2k16\elcounter\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe: error: Sync\CPP: No such file or directory
mingw32-g++.exe: error: projects\September_2k16\elcounter\main.cpp -o obj\Debug\main.o: No such file or directory
mingw32-g++.exe: fatal error: no input files
I am using MinGW g++ compiler.
Just for a test, I tried to compile simple "Hello, world" file and it gave me the same error.
Compiled the same "Hello, world" file in a command line using
"g++ test.cpp -o hello.exe" and in worked just fine, so I believe the compiler is installed correctly.
The error seems to be related to spaces in a file path.
C:\Users\Zahir\Box Sync\CPP projects\September_2k16\elcounter\
mingw32-g++.exe: error: Sync\CPP: No such file or directory
mingw32-g++.exe: error: projects\September_2k16\elcounter\main.cpp -o obj\Debug\main.o: No such file or directory
Might be a problem with a build system in Code::blocks? I tried to copy the command code::blocks using to a command line and it gave the same error. (mingw32-g++.exe -Weffc++ -Wall etc.)
EDIT: I don't want to change file path because "Box Sync" is used by the same name app that synchronizes file with a cloud.(box.com) The app doesn't support changing the main folders name and I'd prefer the project files stay synchronized.
Looks like you need to remove all spaces from file and folder names in your project.
In your case it's the 'CPP projects' folder and 'box sync'

g++: error: `pkg-config: No such file or directory

I installed cygwin and followed this for installation http://cs.calvin.edu/curriculum/cs/112/resources/installingEclipse/cygwin/
then I run this on my cmd
cd opencv
cd sources
cd samples
cd cpp
g++ -ggdb `pkg-config --cflags --libs opencv` facedetect.cpp -o facedetect
It resulted into this
g++: error: `pkg-config: No such file or directory
g++: error: opencv`: No such file or directory
g++: error: unrecognized command line option '--cflags'
g++: error: unrecognized command line option '--libs'
what I'm trying to do is to run facedetect.cpp in opencv to test my classifier any help to fix this issue or provide alternative approach is appreciated
Install the packages pkg-config and libopencv-devel
http://cygwin.com/packages/x86_64/pkg-config
http://cygwin.com/packages/x86_64/libopencv-devel

g++ does not recognize -stdlib=libstdc++

So I just reinstall gcc using home brew, when I compile a programme and try to use libstdc++... I get a error:
dhcp-18-189-47-44:openmp_code myname$ g++-4.8 -fopenmp tmp2.cpp -stdlib=libstdc++
g++-4.8: error: unrecognized command line option '-stdlib=libstdc++'
Someone has idea what is happening ? Thank you.
As the error message clearly says, g++ does not support -stdlib as an option. You can simply remove that option from the command line.
g++-4.8 -fopenmp tmp2.cpp
should be all you need.

Set up SFML with Code::Blocks on windows 8

I had Code::Blocks working on my other Windows 8 computer using the GNU GCC compiler, but when I copied and pasted everything exactly the way it was into my other Windows 8 computer, my projects stopped working. Currently, it throws this error:
mingw32-g++.exe -LC:\Matthew\Documents\SFML-1.6\lib -o bin\Debug\Game.exe obj\Debug\Main.o -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -static-libgcc-static-libstdc++ -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -static-libgcc-static-libstdc++
mingw32-g++.exe: error: unrecognized command line option '-static-libgcc-static-libstdc++'
mingw32-g++.exe: error: unrecognized command line option '-static-libgcc-static-libstdc++'
I looked up the problem and found one place recommending that I remove whatever is listed as an unrecognized command from my linker settings, but when I do that it says that it "cannot find" any of the other things I have in my linker. Is there an easy solution to this problem?
It looks like you have two compiler switches concatenated together when they should be separated with a whitespace:
-static-libgcc-static-libstdc++
Try modifying the linking command to:
g++.exe -static-libgcc -static-libstdc++ -LC:\Matthew\Documents\SFML-1.6\lib -o bin\Debug\Game.exe obj\Debug\Main.o -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d