Can someone point to flags and setup changes required for one to compile C++0x code on a Eclipse CDT on mac please ?
To use C++0x in Eclipse CDT on OSX (in a managed make project):
Open the project properties
C/C++ Build
Settings
Change the "Command" field in "MacOS X C++ Linker" and in "GCC G++ Compiler" from g++ to c++ (before check that c++ is clang++ with "c++ --version" in a shell)
Add "-std=c++0x -stdlib=libc++" in the "Miscellaneous" parameters of "GCC G++ Compiler"
Add "-stdlib=libc++" in the MIscellaneous "Linker flags" parameters of "MacOS X C++ Linker"
Open the "Discovery options", select the "GCC C++ compile" change g++ to c++ and add -std=c++0x to the "Compiler invocation arguments"
Add "/usr/include/c++/v1" to the "includes" in "Paths and Symbols" in C/C++ General
The latest Apple gcc compiler is gcc 4.2 which does not support C+11 code. You need to install a gcc 4.6 - this can be done from source or there are some binaries at hpc this put the gcc in /usr/local/bin Then use that in the preferences fot the C++ compiler in eclipse.
Alternative for Lion and above Xcode 4.* includes clang the latest version of which doies much of C+11
If you want a later gcc macports (and fink and homebrew) have a later version as a port. As of July 2012 macports has 4.7.1 and a 4.8 beta. The package managers are often the easiest way to get complex compiled code onto your machine and they also have centrally compiled versions that will be downloaded by default.
Related
I have installed LLVM 12.0.0 win-64 in my Win-10 machine.
The following is my CLion 2019.3 configuration window for the compiler toolchain:
I don't see Clang or LLVM option here.
How can I add Clang in my CLion IDE?
P.S. Are MinGW and Clang the same or different toolchains?
Most common setups are handled in this section: https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html
On Windows you use MinGW if you want to use Clang.
I was struggling to get some C++ code that involves the header
#include <execution>
working in XCode (Version 11.4 (11E146)) through macOS Catalina Version 10.15.3, as it failed with error:
'execution' file not found
Finally I was able to compile my code by installing the gcc-HEAD version from brew:
$ g++ --version
g++ (Homebrew GCC HEAD-93a49d2) 10.0.1 20200407 (experimental)
However, I'm still struggling to use this g++-HEAD version through XCode. I tried in XCode's "Build Settings" this way:
I also tried to change in above settings: Dialect from C++17 to GNU++17 [-std=gnu++17], and C++ Standard Library to libstdc++ (GNU C++ standard library). But XCode still complains that it couldn't find 'execution' file.
As suggested by #walnut, it seems that I need to set up the clear path to the entirely different compiler other than XCode's default clang. What shall I write down in the below window?
Thanks!
I started using nsight eclipse 6.5 with cuda 6.5 under ubuntu 14.04 for gpu development purposes. But now I'm confused with the toolchains. How to add g++ support to the project and pass linker flags that are used by certain c++ libraries.
It seems that the toolchain consists only nvcc (I can't see any g++/gcc there?)
How to put them in my project?
Thanks
OK I've solved it. I needed to put these flags to the nvcc compiler -> misc settings. Then it works.
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 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.