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.
Related
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).
I have installed the devtoolset-10 package on CentOS 7 and run the /opt/rh/devtoolset-10/enable script so that now when I do this:
g++ --version
I get this:
g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
Great. Trouble is, the headers under /usr/include/c++ still point to ye olde libstdc++-4.8.5. That is, if I do ls in /usr/include/c++, all I see is:
bash-4.2$ ls /usr/include/c++
4.8.2 4.8.5
What is the magic incantation to "enable" libstdc++-10 to be the default system C++ stdlib?
devtoolset-10
Every g++ comes with it's own headers. /usr/include/c++/4.8* is for 4.8.5 only.
devtoolset-10: g++ version 10 is using the headers at /opt/rh/devtoolset-10/root/usr/include/c++/10
"enable" libstdc++-10
There is no shared library "libstdc++-10". There is /opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/{ libstdc++.a, libstdc++.so } , where libstdc++.so is a ~200B text file.
I guess the users are supposed to query gcc for the include path.
On my CentOS /usr/include/c++ is not a symlink, and is not supposed to point anywhere, but one can work around that using update-alternatives (I did that only for the compiler itself only, though). Might be overriden by an update, but those don't happen often enough on CentOS.
What is the magic incantation to "enable" libstdc++-10 to be the default system C++ stdlib?
Developer Toolset uses a hybrid linkage model. This means that it does not come with its own libstdc++.so.6, but uses the system version as far as possible. The missing parts are linked statically. This is achieved by the linker script that Knud Larsen mentions.
If you want to compile using headers from the latest C++ compiler you have on Centos7:
Remove your build directory
Export your chosen compiler specifically: export CXX=g++
Thanks to this comment from github:
I am currently starting to work seriously with C++. I've heard about the new features of C++11 and I like them. So I wonder whether I should write my new project according to the new standard. My current toolchain (that comes with XCode, I guess) does not support features like the auto keyword for type inference.
> g++
i686-apple-darwin11-llvm-g++-4.2
So I am looking for an easy and safe way to get a C++11 toolchain to try it out. I cannot risk breaking my old toolchain.
I know where to get binaries of GCC 4.8 for Mountain Lion, but I don't know how to install all the files manually (and would rather have a package manager do this for me). This discussion explains how to install GCC via homebrew, but I am affraid that this will overwrite and break my existing toolchain.
Also, I do not know how to configure a new toolchain in Eclipse after installation so I can use it with Eclipse/CDT.
You can use the homebrew package manager for OSX: Link
Have a look at https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers and more specifically at homebrew dupes which has duplicates (but more recent versions) for software provided by OS X.
For a reasonable C++11 experience you should look for gcc 4.6 or gcc 4.7. When you have installed a recent version of gcc, you can then use it in your Makefiles. Mind you have to compile with -std=c++0x (gcc-4.6) or -std=c++11 (gcc-4.7+).
You can also look here How to enable C++11/C++0x support in Eclipse CDT? if you get syntax errors and warnings for C++11 constructs in Eclipse CDT.
I'm using code blocks with gnu gcc compiler. But when I try to compile a range base for startment it gives many errors. So I think the compiler dosn't support C++0x. So I want to know how to know the compiler version I'm using and how to update it correctly to a C++0x supporting one. I'm using Windows XP.
This algorithm may help to start with programming with C++11 on Windows:
1) Go to http://mingw.com and download the latest MinGW distribution,
install it
2) Download the CodeBlocks installer, install it. During installation
it should detect GCC installation and propose to use it as default
compiler, accept this.
3) Start a new CodeBlocks project, go to
Project -> Properties -> Build options -> Compiler settings ->
Compiler flags, then set flag "Have g++ follow the coming C++0x ISO
C++ language standard"
4) Compile your first C++11 project and have
fun!
By the way, the latest MinGW g++ is of version 4.6.1 as for now, so it has to support most of C++11 features.
I have to write a c++ program, and i want to do this in vstudio 2010, because it's the most comfortable way for me. But later this code will be compiled in gcc 4.3.2 (ejudge). I can't find gcc 4.3.2 binaries for Windows, if there any ways to check correctness of gcc compilation? Or maybe anyone will help to find gcc binaries? I found this link http://tdm-gcc.tdragon.net/download but there i can't find 4.3.2 version binaries, only source code. Thanks.
MinGW, or Minimalist GNU for Windows, is a set of GNU compilers for Windows platforms. It's the easiest way to use G++ on windows platform. You could also use Cygwin, but it would be a bit of overkill.
As I recall g++ 4.3.2 was used in an older version of the Code::Blocks IDE, as the bundled compiler.
However, I'm currently unable to connect to [http://www.codeblocks.org], so I don't know if they provide downloads of older versions.