gcc: error: unrecognized command line option ‘-combine’ - c++

I am trying to compile lode library from here.
However when running make on the yajl.o source I end up with the error:
gcc: error: unrecognized command line option ‘-combine’
I am using 4.9.2 gcc on ubuntu 12.04. I also tried gcc 4.8.1 on different pc.

I believe -combine was removed in GCC 4.6. However, there is a PR to fix this for lode here.

Related

Trying to compile a C++ code with Root (Cern) parameters included

I working on trying to compile a code written in C++ and Root on my Mac. The code is from a colleague who works on a Linux laptop. In addition to the different OS's, I have both a different version of gcc and Root than her and I am not sure which difference is causing the code not to compile on my machine.
She has g++ 4.8 and root 5.(something). I have gcc 5.3.0 and root 6.06/02.
She has given to me the a line of code she uses to get her machine to compile the code
gcc -Wall -o executable_name code_name.cc `root-config --cflags --glibs`
But when I write on my machine, Terminal gives me the error
gcc: error: unrecognized command line option ‘-stdlib=libc++’
gcc: error: unrecognized command line option ‘-stdlib=libc++’
I need help generating the correct line to get gcc to compile the code.
The problem here is two-fold: You're on OSX and you are using GCC.
The problem with this is that root-config assumes that since you're on OSX you will be using the OSX-standard Clang compiler which have the -stdlib flag. Since you're not using Clang, but GCC (which doesn't have this flag) you get an error.
You have two possible solutions: Use clang++ instead of g++ to compile and build (requires you to install the compiler if it's not installed already, it comes with Xcode), or to modify the root-config script so it doesn't add -stdlib=libc++. There might be environment variables or flags that the root-config script checks that alter the behavior, but I don't know anything about the script, you have to check it for that.

cc1plus: error: unrecognized command line option ‘-std=c++11’ while installing Cling in Ubuntu 12.04 using gcc 4.8

I am trying to install Cling(interactive C++ interpreter) from here using the .sh file. While I run the .sh file in the terminal, I get the following errors:
cc1plus: error: unrecognized command line option ‘-std=c++11’
Since the default gcc for 12.04 is 4.6.3, I updated to gcc 4.8 to help remove C++11 errors, then ran the following commands to check which version of gcc is being used for compilation
gcc --version
gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
I also tried to figure out the current priorities of gcc, as mentioned here,
update-alternatives --query gcc
Link: gcc
Status: auto
Best: /usr/bin/gcc-4.8
Value: /usr/bin/gcc-4.8
Alternative: /usr/bin/gcc-4.8
Priority: 50
But the "cc1plus" error still remains. Is there a way to resolve this to help me run Cling seamlessly? Thanks!
EDIT: Followed this and also updated my g++ from default 4.6.3 to 4.8.1 and the dont see the C++11 error anymore.

How to make "cc1plus: error: unrecognized command line option" a warnings with -Werror?

I have a project that is using gcc 4.6.3, and am trying to migrate to 4.8.2. However, it needs to compile on 4.6 for a while. It is using -Werror with a few specific errors turned off. To use boost 1.55 with gcc 4.8, i needed to add -Wno-unused-local-typedefs. The problem is that with -Werror, gcc 4.6 emits this error:
cc1plus: error: unrecognized command line option "-Wno-unused-local-typedefs" [-Werror]
The gcc docs on warning options have no indication this particular warning can be treated explicitly as a warnings rather than an error. Is there any way to get 4.6 to treat this as a warning?

C++11 on Mac with Clang or GCC

I have Xcode 4.5.2 on Moutain Lion, and I have install the lastest "Command Line Tools" but when I tried to compile with g++ or clang++ (and the options -std=c++11 -stdlib=libc++) I get an error.
With g++:
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-stdlib=libc++"
With clang++:
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
It's in a Qt project.
So how can I used the C++11 on my Mac ?
As you found, g++ does not support those command line options.
It sounds like you're using Xcode.
For clang, you should look at the project settings, and make sure that the "Deployment Target" is set to 10.7 (or 10.8)
What the error message is telling you is that libc++ is not available for 10.6 and before.
I installed gcc-4.7 on my Mac to make C++11 work. GCC in its current version is fairly good at supporting C++11, so this should be a fair choice.
The installation can be done by Homebrew and is not that complicated (at least I was able to do it...)
To install Homebrew if you do not already have it:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
Now run
brew doctor
and fix whatever problems come up (there is something written in the hombrew documentation for that). Finally, install current gcc:
brew install gcc
If everything goes well you should be able to access g++-4.7, which allows -std=c++0x.
Try -std=c++0x if c++11 doesn't work. Support for the -std=c++11 option is relatively new in GCC and you might not have a recent enough version.
I'd trust Marshall on the libc++ issue.

Cannot compile using -std flag with g++

I'm running Windows 7 with cygwin installed and trying to have a play around with some of the newer C++ features. I'm aware that in order to enable these features I have to pass g++ the -std=c++0x flag, however that gives me the following error:
cc1plus: error: unrecognized command line option "-std=c++0x"
The command line I'm issueing that gives rise to that error is:
g++-3 hello.cpp -std=c++0x -o hello
The reason for the g++-3 is because windows has trouble with the symbolic link. I've used g++ in the cygwin terminal and the result is the same anyway.
Any ideas?
You need to be using a version of GCC which supports C++ 2011 features.
This page has a list of compilers and which features each one supports. If I were you, I'd try to use GCC 4.7 if at all possible.