cc1plus: error: unrecognized command line option "-Wno-implicit-fallthrough" [-Werror] - c++

I am getting this error when I am cross compiling compute library on x86 for arm by using SCons.
Here I am cross compiling this to run a tensorflow model on armnn sdk.
How I can solve this error?
Please give me suggestion.

-Wno-implicit-fallthrough was first added in gcc-7. You are probably using an older version of the compiler, which does not recognize the option.
You have several options:
Use later version of gcc
Remove -Wno-implicit-fallthrough flag from gcc call
Add -Wno-unknown-warning to suppress the warning

Related

Problem with using clang as compiler for code::blocks

I installed llvm for clang, because I wanted to use clang for code::blocks as compiler, since I need compiler that supports c++20, so I installed llvm, the bin was added in environmental variables, even the code::blocks detected llvm as compiler, however I get error when i want to compile my code:
-------------- Build file: "no target" in "no project" (compiler: unknown)---------------
clang++.exe -c C:\Users\Temirlan\labs\lab4\rpn.cpp -o C:\Users\Temirlan\labs\lab4\rpn.o
clang++.exe -o C:\Users\Temirlan\labs\lab4\rpn.exe C:\Users\Temirlan\labs\lab4\rpn.o
C:\Users\Temirlan\labs\lab4\rpn.cpp:180:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
Do you know what is the problem or maybe the picture will help?
photo of compiler executables in code::blocks
I got error of "fatal error: 'iostream' file not found"
All modern compilers support C++20 (to slightly varying extent): both Clang, GCC, and MSVC. So this shouldn't affect your choice (but I do think that Clang is the best option).
Clang can be set up in different ways: (in order of personal preference)
With GCC's standard C++ library, libstdc++. Install MSYS2, then use it to install both Clang and GCC: pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-clang. Then use C:/msys64/ucrt64/bin/clang++.exe as the compiler. (There's also MINGW64 variant instead of UCRT64, read about the difference here).
With its own standard C++ library, libc++. Install MSYS2, then use it to install libc++-flavored Clang: pacman -S mingw-w64-clang-x86_64-clang. Then use C:/msys64/clang64/bin/clang++.exe as the compiler.
With MSVC's standard C++ library, aka MSVC STL. Install the official Clang build, and install Visual Studio.
Note that the first two options don't involve downloading the official Clang build. The official build wants the MSVC STL by default, which you don't have, since you didn't install VS. (And if you do install it, you might as well use it instead of CodeBlocks.)
The official Clang build can be made to work with other standard libraries, but they need to be installed separately, and you need to persuade it with some compiler flags. It's easier to install the MSYS2's version, which already uses the correct flags by default.

g++: error unrecognized command-line option -municode using Cygwin

I am trying to build GetDP (finite-element sofware) from source using the 64-bit GNU compilers in Cygwin, namely gcc.exe, g++.exe and gfortran.exe, with their toolchain x86_64-pc-cygwin. I have the same error while linking the executable getdp.exe (in my case raised by the g++ compiler):
g++: error: unrecognized command-line option ‘-municode’
How can I solve the issue? Are there some packages that can be installed within Cygwin to enable the -municode command in the toolchain of the compilers?
I have very little experience with C/C++ programming and compilation.
Any help is really appreciated.
Strictly related to this issue.
The problem was not in Cygwin compiler toolchains, but in the CMakeList.txt file of the software I was trying to compile (GetDP).
Now the issue is fixed and the executable can be built without any errors using both gcc and mingw-x64 within Cygwin.

How do I run go test with the -msan option on Ubuntu 18.04?

When I try to run the go unit test system with the memory sanity checking I get an error message that I am sure I use to solve by setting my compiler to CLANG.
The Go Command Documenation is a little brief on the matter.
-msan
enable interoperation with memory sanitizer.
Supported only on linux/amd64, linux/arm64
and only with Clang/LLVM as the host C compiler.
On linux/arm64, pie build mode will be used.
In the past I was use I got this to work by calling:
CC=clang go test -msan ./..
However when I do that now I get errors such as:
g++: error: unrecognized argument to -fsanitize= option: ‘memory’
What do I need to do in order to run my golang tests with the memory sanitizer under Ubuntu 18:04 ?
I am using the following versions of tools at the moment:
$ go version
go version go1.14 linux/amd64
$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
It requires a version of LLVM that supports -fsanitize=memory on your version of Ubuntu 18.04 that the program runs on. Please try updating and then try it again.
Also do note, on Linux you need at least LLVM 3.8 to get the -fsanitize flag.
The Go tool automatically adds the -fsanitize=memory option to CGO_CPPFLAGS flag as required by clang for linking and that's where it's resulting in an error for you.
Also, make sure to add both CC and CXX (for clang++) flags so to enable compilation using Clang when you're interop your program with C/C++ i.e.,
CC=clang CXX=clang++ go build -msan
Also do refer this link:
https://go.googlesource.com/go/+/go1.7/misc/cgo/testsanitizers/test.bash (bash script)
(or)
https://github.com/golang/go/tree/master/misc/cgo/testsanitizers (*.go files)
It will help you test the sanitizers if they would work on your setup or not.

unrecognized command line option “-std=c++11”

I am trying to run wiringPi Cpp version with raspberryPi. I downloaded this and tryed to run but I go the error below.
What is the problem here? Did I do something wrong?
Upgrade your GCC. You appear to have GCC 4.6, and the flag you mention was introduced with GCC 4.7.
Run g++ -v on the command line. If the version number is 4.3 through 4.6 replace -std=c++11 with -std=c++0x and see if you get any love. If that still doesn't work, you'll have upgrade the compiler or remove the c++11 features from the library. Seriously recommend the former over the latter.
If the compiler is before version 4.3 definitely upgrade.
edit
I need to read more goodly. skip getting the version number. Try -std=c++0x, then upgrade the compiler if it fails.

configure C++11 properly on Netbeans 8.0.2 on mac

I had difficulty using C++11 compile via Netbeans. I have added '-std=c++11' in the additional option and the Netbeans gave me the following error:
error: invalid value 'c++11' in '-std=c++11'
BTW I already have GCC 4.8.4, and C++11 works fine when I just use my terminal.
Any suggestions? Should I set path for the compiler somewhere? Thanks.
Update:
I set the path of g++ compiler to the proper one on Properties->Build, now I get another slightly different error message:
cc1plus: error: unrecognized command line option "-std=c++11"
Really need some help here! Thanks.
First, make sure your compiler is setup properly (Tools -> Options -> C/C++, use Versions ... to test if everything is ok).
You can enable C++11 by the project settings: Open the project options, go to Build -> C++ Compiler and select C++11 at the C++ Standard option.
If building fails, please check (and post) the build output. There should be some g++ lines, look for the std=c++11 part there.