Chilitags compilation on Linux - c++

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.

Related

where and how do i get gcc g++ 7.3.0

I would like to use SFML but at first place i need to get the same version of SFML and dev c++ compiler. It was easy to get the SFML 7.3.0 version, but i can't find the 7.3.0 version of compiler, even the MinGW installation manager doesn't have it, but i need it. I've tried searching the internet, but i found nothing that could possibly help me. The only way for me to use SFML, is using 4.9.2 version of compiler and SFML for now, but it's old and have a lot of bugs/oversights. So if u use SFML 7.3.0 or know how to get and use it, pls tell me how to.
I don't follow your statement that you need the MinGW GCC 7.3.0 compiler to build SFML 7.3.0.
When looking at SFML (https://www.sfml-dev.org/download.php) the latest version seems to be 2.5.1.
That version builds perfectly well with more recent versions of MinGW/MinGW-w64.In fact even the latest GCC 11.2.0 can build it - I used the 64-bit standalone build from https://winlibs.com/ to try this.
GCC 7.3.0 is several years old. There is usually no reason to use very old GCC versions. Instead you can tell GCC to use an older standard of the C language with the -std= flag (e.g. -std=c89).

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.

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.

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.

How do I use gcc builtin __sync_bool_compare_and_swap in g++ on MacOSX?

I have some code that uses:
__sync_bool_compare_and_swap
it compiles fine on Linux.
But when I try to compile it on MacOSX in g++, I get:
error: ‘__sync_bool_compare_and_swap’ was not declared in this scope
How do I fix this? (This is Mac OSX 10.5.8, so it's intel .. .and should have this instruction).
Thanks!
Try adding the command line option
-march=i686
to the linker.
If you can't find it, you can use OSCompareAndSwap() on Mac.
But it would be nice to have cross-platform code, wouldn't it.
if gcc --version doesn't show gcc 4.1 or newer then you don't have the instruction.
Xcode 3 (which is what's on Leopard) ships with gcc 4.2, but the default compiler is 4.0, which doesn't have the instruction
I just tested it on snow leopard, and the default gcc is 4.2.1, where it works.
Please see the note: Setting GCC 4.2 as the default compiler on Mac OS X Leopard
What versions of GCC are you using? (On both platforms). This is a relatively recent addition to GCC.
At a guess, your box doesn't have the library you used on Linux that uses that function.
(The function wraps the instruction)
OSAtomicAdd32 in libkern/OSAtomic.h
the symbol __sync_bool_compare_and_swap is included in the toolchain(gcc/g++, and other compilers), and related with the version.
sometimes, you will find it, like this:
./arm-fsl-linux-gnueabi/4.6.2/lib/gcc/arm-fsl-linux-gnueabi/4.6.2/plugin/include/sync-builtins.def: "__sync_bool_compare_and_swap",
./arm-fsl-linux-gnueabi/4.6.2/lib/gcc/arm-fsl-linux-gnueabi/4.6.2/plugin/include/sync-builtins.def: "__sync_bool_compare_and_swap_1",
./arm-fsl-linux-gnueabi/4.6.2/lib/gcc/arm-fsl-linux-gnueabi/4.6.2/plugin/include/sync-builtins.def: "__sync_bool_compare_and_swap_2",
./arm-fsl-linux-gnueabi/4.6.2/lib/gcc/arm-fsl-linux-gnueabi/4.6.2/plugin/include/sync-builtins.def: "__sync_bool_compare_and_swap_4",
./arm-fsl-linux-gnueabi/4.6.2/lib/gcc/arm-fsl-linux-gnueabi/4.6.2/plugin/include/sync-builtins.def: "__sync_bool_compare_and_swap_8",
./arm-fsl-linux-gnueabi/4.6.2/lib/gcc/arm-fsl-linux-gnueabi/4.6.2/plugin/include/sync-builtins.def: "__sync_bool_compare_and_swap_16",