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.
Related
I am trying to compile my .cpp with -fno-leading-underscore option but it raises an error saying:
clang: error: unknown argument: '-fno-leading-underscore'
g++ -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -o kernel.o -c kernel.cpp
How can I fix this I am new to Mac it used to work on Linux Mint
In your terminal, type g++ and press enter. You will probably get:
$ clang: No input files
As you can see its still clang underneath.
To fix this, first cd into /usr/local/bin and type ls. You will see the binaries inside:
g++-9
...
Next, create a symlink to it so that you can invoke g++ directly
ln -s g++-9 g++
If it still doesn't work for some reason, you can explicitly write g++-9 or whatever version you have. You can even give the full path /usr/local/bin/g++-9
I am new to OpenMP, and my professor gives us a project to do. There are only three files in the folder: a C++ source code a0.cpp, a header a0.h, and a Makefile. When I want to run the code in my terminal, it says:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [a0] Error 1
I am using a Macbook, and I do not know how to fix this. Can you help me? Thanks.
After installing libomp with homebrew using:
brew install libomp
I was able to compile an OpenMP program with this:
clang -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.c -o main
If you are using C++, you'd likely want:
clang++ -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.cpp -o main
i'm like working client-server application..
I'm trying to run the server - CountryServer.c file..
i tried with g++ and gcc and i got compilation errors.. i even googled and got answers.. sadly i still got the same errors..
with gcc
oh, i even also tried to enable std=c++11
and std=c++0x but it says no input files.. >.<
i enabled using this command:
gcc -std=c++11
and also tried this other enabled commands:
g++ -std=c++1 CountryServer.c -o CountryServer
and
g++ -Wall -g -std=c++11 CountryServer.c -o CountryServer
for both 0x & 11
andd,i've also checked which version has the iostream and also checked the gcc or g++ version >.<
i really dont understand and dont know what other ways/solutions/methods..
please help me! thanks ! :D
for iostream error,
can you please try compiling with g++
or
compiling gcc with option -lstdc++
gcc -o -lstdc++
When I try to compile the next simple example of code:
echo "#include <cmath>" | g++ -x c++ -c - -m64 -mfpmath=both -std=gnu++11 -o /dev/null
(along with -m64 option is activated (by default) a using of SSE (say, AVX)).
It is appear the following error message:
In file included from <stdin>:1:0:
c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/cmath:1040:11: error: '::double_t' has not been declared
c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/cmath:1041:11: error: '::float_t' has not been declared
Is this a bug?
Without -mfpmath=both option an error does not happen.
My workaround is to add the -D__FLT_EVAL_METHOD__=2 (and -Wp,-w if -Werror is present, because of "is redefined" warning) to g++'s option list. I think that this is a dirty way.
This error is in wrong commit on mingw-w64 trunk. I wrote a bug report for this. Thanks!
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.