How to suppress Xcode emitting -stdlib flag? - c++

I am attempting to build using GCC 4.8 from within Xcode, following this procedure (only using version 4.8 instead of 4.7).
After fixing a few minor build failures, my project compiles correctly, but linking fails with the following error:
g++-4.8: error: unrecognized command line option '-stdlib=libc++'
The -stdlib= flag is supported by LLVM, but not GCC, hence the error.
In Build Settings, there is a CLANG_CXX_LIBRARY flag under the User-Defined heading. When I change the value of this flag, the error changes to reflect the current value. However, I cannot remove this flag from the project entirely.
Is there a way to stop Xcode from emitting the -stdlib= flag?

In XCode 6 you can select C++ Standard Library to Compiler Default. XCode then won't produce the -stdlib= option.

Related

"enable_if_t" not a type gcc 8.3.1

System specifications: Centos 7 with devtoolset-8 enabled (gcc 8.3.1), cmake 3.14.6
I seem to have an error regarding gcc versioning causing a 'type error'
I am trying to build a gitlab project (https://github.com/ColinKennedy/USD-Cookbook/tree/master/plugins/custom_resolver) which needs a built version of Pixar's USD. I've already successfully built USD and run the following commands to build the custom resolver project and provide it the location of USD:
scl enable devtoolset-8 bash
USD_INSTALL_ROOT=/home/fernandos/Documents/USD cmake ..
make install
however during make install this error pops up:
/home/fernandos/Documents/USD/include/pxr/base/tf/hash.h:44:6: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
std::enable_if_t<std::is_integral<T>::value>
This type error seems to indicate an error possibly caused by a wrong version of gcc if I look at other stack overflow posts. I know that enable_if_t was added in c++14, so if you have an old compiler (such as the standard gcc 4.8.1 on Centos 7) it would throw this error as it standard uses c++11 to compile.
However, I'm using the devtoolset-8 environment and everything seems to indicate that I am using gcc 8.3.1 to compile (I even make the MakeFile print the version out). So, how is it possible that I get this error, does gcc 8.3.1 not know this type?
I also noticed that the error originates from my USD build: I am not sure if this matters, but I built it with gcc 6.3.1 (which certainly knows the enable_if_t type). As I am relatively new to building on linux with cmake/make could this cause problems?

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

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

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.

MinGW 4.7.1 doesn't recognize command line option -static-libstdc++

So I recently installed a new version of CodeBlocks with the MinGW 4.7.1 compiler, and I am no longer able to build my projects. The compiler throws the following error:
error: unrecognized command line option '-static-libstdc++'
I believe I was previously using 4.4.1 (going by the files in MinGW/bin). I installed the CobeBlocks 12.11 package that is supposed to come with the 4.7.1 compiler included.
How do I solve this? Removing that option from the compiler settings causes my previously functional application to instantly crash upon startup.
The compiler bundled with Codeblocks 12.11 is tdm-gcc 4.7.1, which by default links libstdc++ statically and reports -static-libstdc++ as an error. So if you want to dynamically link to libstdc++, add -shared-libstdc++.

Activating C++11 support in Clang

I've downloaded and built clang version 3.0 in order to play around a bit with C++11 features, however I get this error (even though I am using the -Wc++11-extensions flag).
S:\llvm\code>clang++.exe -Wc++11-extensions variadic.cpp
variadic.cpp:4:19: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <typename... Args>
I've built clang with VS10 on Windows 7 (64bit) and the build passed successfully.
Edit: As #cli_hlt pointed out this is a warning not an error, the error is something I did not paste unable to execute command: program not executable. The root cause for that was that link.exe was not in the PATH. Once I ran from a VS command prompt all was well.
You are getting a warning, not an error.
The -W switch is used to enable compiler warnings. So for my understanding, by using -Wc++11-extensions you tell the compiler to warn you if you are using C++11 extensions.
And thats exactly what happens here.