1

I am studying a algorithm code which uses some c++11 features, however my linux system only has the gcc4.4.7 and I donot have permission to update this version. I was told that by running some kind of scripts can solve this problem, that means using gcc4.4.7 can still compile the c++ code which has the c++11 features.

my problem is that currently I only have gcc4.4.7 in linux system, so I wander if there is a solution that can help me compile a algorithm code which uses the c++11 features like the keyword "nullptr","constexpr" and so on, just using gcc4.4.7.

By the way,I have already know that gcc4.7 and above can support c++11.

Thank you very much!

asked Oct 12, 2016 at 7:04
7
  • You where told by whom? AFAIK you need a compiler which supports c++11 to compile c++11 so this won't be possible. Commented Oct 12, 2016 at 7:13
  • gcc -std=c++0x does not work? Commented Oct 12, 2016 at 7:13
  • 1
    Possible duplicate of How do I enable C++11 in gcc? Commented Oct 12, 2016 at 7:14
  • for example, There is a piece of code that uses the "nullptr" which was introduced in c++ 11, so using the "gcc -std=c++0x" doesn't work, the "nullptr" would be recognized undeclared. @JohnB Commented Oct 12, 2016 at 7:30
  • my problem is not like the " How do I enable C++11 in gcc?". Currently, I only have gcc4.4.7, but a algorithm code I am studying uses the c++11 features like the keyword "nullptr","constexpr" and so on. So, I wonder if there is a solution that can help me compile this algorithm code only using the gcc4.4.7. Thank you !@HumamHelfawi Commented Oct 12, 2016 at 7:38

1 Answer 1

1

If the compiler doesn't support a language feature, there is no magic "script" to run to alter the compiler's understanding of the code. As seen here some core C++11 features are not available in gcc 4.4.

So what can you do?

  • Ask your sysadmin to give you temporary permission to install, or ask him to install it.

  • You could install the latest gcc locally on your account. This needs less permissions than the classical install.

  • Alternately, you can install gcc from source in a local directory. This should be 100% doable without any special permission (other than write on your home dir)

  • Alternately, if the algorithm you are studying doesn't have many sources and doesn't use any library other than boost, you can compile and run it online. You can search for yourself, there are many C++ online compilers. http://melpon.org/wandbox/ is great because it supports multiple source files, the boost libraries and even development versions of future versions of gcc and clang.

answered Oct 12, 2016 at 8:40
Sign up to request clarification or add additional context in comments.

2 Comments

@MingjieLi you are welcome. Which solution worked for you?
probably it is your idea of installing locally. Later, I note that our linux(redhat) system have the Redhat Developer Toolset which could provide the required environment.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.