configure C++11 properly on Netbeans 8.0.2 on mac - c++

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.

Related

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

Xcode gcc: dependency_info.dat No such file or directory

Hi anyone can help with dependency_info.dat No such file or directory? I'm using Xcode 7 with gcc 4.8
-dependency_info /path/my_project/build/my_project/Debug/my_project.build/Objects-normal/x86_64/my_project_dependency_info.dat
g++-4.8: error:/path/my_project/build/my_project/Debug/my_project.build/Objects-normal/x86_64/my_project_dependency_info.dat: No such file or directory
Command /usr/local/bin/g++-4.8 failed with exit code 1
what does -dependency_info flag do? How can I remove this flag?
The error went away after I deleted the path specified in Build Settings "Path to Linker Dependency Info File" for the project and the targets. So far the app is compiling and running fine without a specified path.
I had a very similar error with Xcode 7.2, OpenCV 3 and El Capitan.
In my case (and probably in yours as well), it's a linker error disguised as something else.
My project builds fine via terminal (because it already has a makefile that uses gcc), but no chance with XCode even after I configure everything in Build Settings pane according to the makefile.
This answer saved me. My OpenCV was installed using macports (it might have been precompiled binaries, or compiled on my machine, can't remember). It turns out that it's compiled with libc++ and not libstdc++.
Changing the C++ Standard Library setting accordingly in Build Settings did the trick for me.
For me it was trying to use a "/" in the app's display name that caused the build error

Clang : Failed to find C++11 headers

I am trying to build all the examples in the Crow library with clang 3.6 and I can see the CC/CXX has been found properly by using clang 3.6. It uses cmake which I am not quite familiar with.
However it failed to find C++11 headers.
Error is like:
'future' file not found
It seems that the libstdc++ is not specified properly, or some people reckon it needs to build the clang libstdc++ myself.
Anyone can shed some light on this will be much appreciated.
So based on the previous comment the issue is that you don't enable the C++ 11 mode in Clang.
As in referenced question, the issue is simply that you do not say to Clang (or in future for GCC) to look for C++ headers.
"Clang's command line is gcc-compatible so you have to enable C++11 support via the followinf command-line switch"
-std=c++11
If after this you all you have to do is to write your C++ 11 code. If you use Makefiles you should add to your CXX arguments the command line switch to Clang.

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++.

How to suppress Xcode emitting -stdlib flag?

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.