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

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.

Related

Trying to get CUDA 7.5 to work with GCC 5.x

So, if you try to use nvcc when the system GCC is version 5 and up, you get an "unsupported version" error. But - I've heard people report that they've just commented this out and that CUDA 7.5 "works for them" with GCC 5.x .
When I do the same, however (the check is in $CUDA_DIR/host_config.h), and compile something, I get the following errors:
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/mwaitxintrin.h(36): error: identifier "__builtin_ia32_monitorx" is undefined
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/mwaitxintrin.h(42): error: identifier "__builtin_ia32_mwaitx" is undefined
and a bunch of others, but those may be dependent on these. Now, these are MMX-related intrinsics for X86 architectures. I don't use them directly, so I'm guessing they're opted-in somehow. Perhaps this can be avoided?
Is there a way to overcome these errors and actually get GCC 5 to coexist with CUDA 7.5? And for code to build and run?
Notes:
I've read a suggestion to use -D__STRICT_ANSI__. I have, and it doesn't seem to help.
I'm on Fedora 22 in case it matters.
I think a -D_MWAITXINTRIN_H_INCLUDED option should fix the issue. Actually I employed a slightly different approach, commenting out the #include <mwaitxintrin.h> line in x86intrin.h, and successfully built TensorFlow with CUDA 7.5 and GCC 5.2.1.
UPDATE
For the latest version of TensorFlow (v0.8.0), simply choose to use gcc 4.x when invoking the configure script.
Consider installing and temporary selecting an older version of the gcc:
apt-get install gcc-4.8
Then update your alternatives:
update-alternatives --remove-all gcc
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
After compiling TensorFlow you can use previous version of gcc calling above command with proper path to /usr/bin/gcc-5.x.
It's essentially futile to try to get GCC 5.x to work with CUDA 7.5 - there are some (or many?) incompatiblity issues which you simply can't resolve. Instead, just upgrade to CUDA 8.0 which has become available since this question was asked.

Compile c++14-code with g++

I'm using g++ 4.8.4 on Ubuntu 14.04 LTS. When trying to compile with '-std=c++14', I get this error:
g++: error unrecognized command line option '-std=c++14'
Compiling with '-std=c++11' works fine, so I'm not sure what's going on. Does g++ really have no support for c++14 yet? Am I using a wrong command line option?
I used "sudo apt-get install g++" which should automatically retrieve the latest version, is that correct?
For gcc 4.8.4 you need to use -std=c++1y in later versions, looks like starting with 5.2 you can use -std=c++14.
If we look at the gcc online documents we can find the manuals for each version of gcc and we can see by going to Dialect options for 4.9.3 under the GCC 4.9.3 manual it says:
‘c++1y’
The next revision of the ISO C++ standard, tentatively planned for 2014. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.
So up till 4.9.3 you had to use -std=c++1y while the gcc 5.2 options say:
‘c++14’
‘c++1y’
The 2014 ISO C++ standard plus amendments. The name ‘c++1y’ is deprecated.
It is not clear to me why this is listed under Options Controlling C Dialect but that is how the documents are currently organized.
The -std=c++14 flag is not supported on GCC 4.8. If you want to use C++14 features you need to compile with -std=c++1y. Using godbolt.org it appears that the earilest version to support -std=c++14 is GCC 4.9.0 or Clang 3.5.0
G++ does support C++14 both via -std=c++14 and -std=c++1y. The latter was the common name for the standard before it was known in which year it would be released. In older versions (including yours) only the latter is accepted as the release year wasn't known yet when those versions were released.
I used "sudo apt-get install g++" which should automatically retrieve the latest version, is that correct?
It installs the latest version available in the Ubuntu repositories, not the latest version that exists.
The latest GCC version is 5.2.
Follow the instructions at https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91 to set up the gcc version you need - gcc 5 or gcc 6 - on Ubuntu 14.04. The instructions include configuring update-alternatives to allow you to switch between versions as you need to.

OpenMP on Mac not working anymore

I had OpenMP compiling and executing in C/C++ on my Mac but then I formatted and reinstalled a fresh copy of OS X. I believe the only difference in the setup was that I had Xcode 5 before the format, and now I have Xcode 6.
Now I get fatal error: 'omp.h' file not found
I read this has something to do with clang and gcc, but, my confusion lies with why did it work before and now its not working?
After some research I seem to have found an answer.
GCC included in the latest version of Xcode (Xcode 6) is only a symbolic link to clang. Since clang does not support OpenMP at this time, you need to install a different version of GCC. The easiest way to do this would be to use Homebrew or MacPorts.
Keep in mind that even when you do this you will probably need to alter your $PATH to have /usr/local come before /usr/bin. This is because Homebrew will have placed your newly installed GCC in /usr/local. Also, some implementations may name the command gcc-49 instead of plain gcc.
Mac OSX uses clang.The gcc compiler in OS X does not support OpenMP. To use this feature a new gcc compiler needs to be installed.
Go to Terminal, if you have not installed Hombrew, install it:
/usr/bin/ruby -e "$(curl -fsSL https://`enter code here`raw.githubusercontent.com/Homebrew/install/master/install)"
then install new version of gcc
brew reinstall gcc --without-multilib
This will not make changes to the existing gcc compiler installed by Xcode as we are reinstalling it.
After running the command given below compile the files using the new version of gcc using the syntax : gcc-version -fopenmp filename.c
To find the version type gcc and then press tab. This will list out all the possible variants of gcc. The version number can be found out from this. For example : gcc-6, gcc-4.9,etc

Chilitags compilation on Linux

anyone has any experience with Chilitags? I tried to implemented it on my Virtual Linux, I followed all the steps the instructions give, but when I tried to make build it gave this error.
cc1plus: error: unrecgonized command line options `-std=c++11`
Can somebody tell me what this error means. My cmake version is 2.8.7 and gcc version is 4.6.3.
Thanks
GCC version 4.6 is far from the latest version, it's up to 4.9 now.
The problem is that the flag -std=c++11 didn't get into GCC until version 4.7, before that it was -std=c++0x.
You might also want to know that the support for C++11 (or C++0x as it was still called then) was far from complete in GCC 4.6.

Know g++ Version of Code blocks in Windows

I am solving questions on Interviewstreet.com. They said they use C++ version g++ 4.6.3,C0x mode.
I am writing code on code blocks. So i want to know which version iam using in code blocks is it in C0x mode or C11 mode??
I have tried using g++ --version i got g++ TDM-2 mingw32 4.4.1.Can u tell me where i can get this kind of information.
what is the difference between C++ 0x and C++11??
You'll have to update the version of g++ to 4.6.3 (or later) if you want to use c++11 features. See this question and it's answers on how to do it for deb linux.
Then you'll have to pass --std=c++0x to the compiler in options. You should be able to easily find them in codeblocks.
what is the difference between C++ 0x and C++11??
c++0x is a synonym for c++11.
The command:
g++ --version
gives you the version of your g++ or mingw compiler. Since you got g++ TDM-2 mingw32 4.4.1 then your version is 4.4.1. If you want to use version 4.6.3 as in that web site, then you would have to update.
It wouldn't hurt to use a newer than 4.6.3 version of mingw, so please see here for the latest version. This page offers an windows installer for mingw.
After installation, you would have to configure CodeBlocks to use the newly installed compiler by looking into Compiler and debugger settings -> Toolchain executables tab and setting the paths for the compiler-related executables to the new ones.
Hope this helps.
EDIT:
Here is a small tutorial/example of what the CodeBlocks settings look like.