XCode 5 vs XCode 4 - where are the options - c++

My old Mac had 10.6 and XCode 4.2 (which was the latest for that system). There I was able to select "Other C Flags" and "Other Link Flags" and set them appropriately.
Now I got a Mac which has 10.8. I install XCode 5.1.1 and I couldn't find those settings anymore.
Are they being split up? Renamed? If that's the case how do I set them up?
I know its not actually a programming question, but its tightly related and also I asked to post XCode related stuff here on SO from "Ask Different".
Thank you in advance and hopefully this question is OK to ask here. If not please point me to the proper place on any SO site and I will gladly move it.

I think this is indeed a programming question, since it has to do with Xcode.
If you open your project in Xcode, select the target (which is the app you ultimately build) and then click on "Build Settings".
There should be a search field into which you can type in the search term "Other".
Here's a screenshot of what I see when I do this in Xcode 7:
I've circled "Other Linker Flags" and "Other C Flags" for you. You should see the same results in Xcode 5 & 6.

Related

C++ Lambda error on Mac (gcc out of date?) [duplicate]

This question was asked many times and I failed to replicate all of the solutions I could find. I am unable to find this setting under File->Project Settings (as some suggested). Please be very specific. If you know an answer for Xcode 7, chances are it will work for me too.
It's the same for 7 and 8. From the Project Navigator, select the project. In the main panel, at the top left, select the target. Now the main panel should have General, Resource Tags, Build Settings, Build Phases, & Build Rules along the top. Select Build Settings, select All. Scroll down to "Apple LLVM 8.0 Language C++" and expand it. Change "C++ Language Dialect" to "C++11 [-std=c++11]".
Build Settings -> Linking-> other linker flags -> add to "-lc++"

How to compile a project with C++11 under Xcode 8?

This question was asked many times and I failed to replicate all of the solutions I could find. I am unable to find this setting under File->Project Settings (as some suggested). Please be very specific. If you know an answer for Xcode 7, chances are it will work for me too.
It's the same for 7 and 8. From the Project Navigator, select the project. In the main panel, at the top left, select the target. Now the main panel should have General, Resource Tags, Build Settings, Build Phases, & Build Rules along the top. Select Build Settings, select All. Scroll down to "Apple LLVM 8.0 Language C++" and expand it. Change "C++ Language Dialect" to "C++11 [-std=c++11]".
Build Settings -> Linking-> other linker flags -> add to "-lc++"

Cross compiler prefix and path in eclipse

I'm trying to create a C++ project on eclipse. I have installed eclipse-cdt for that.
While creating a project, a pop up window asks for cross compiler prefix and cross compiler path. Could someone please explain what are those and what do I need to add in those fields? Are those fields absolutely necessary to fill?
If you are using a Mac, you can select MacOS GCC instead of Cross GCC. If you are on Windows, you will have to install a C++ compiler. I recommend you install Cygwin, try following the directions here.
https://www3.ntu.edu.sg/home/ehchua/programming/howto/eclipsecpp_howto.html
Once you've installed the C++ compiler, restart Eclipse and try to create the project again. Hope this helps.
In Cross compiler Prefix you need to write 'arm-none-eabi-' and in Cross compiler path you have to select the path for GCC bin folder. You need to install Cygwin GCC for this.
I have found few steps in below link.
https://www3.ntu.edu.sg/home/ehchua/programming/howto/Cygwin_HowTo.html#cygwin
Just in case anybody else is like me and needs more explicit directions as #yeremy is correct in that you have to select MacOSX GCC. It's just that at the point where the OP is, he overshot where he could have made the selection and needs to back up a few windows (about 3) to choose the MacOSX GCC as the Toolchain of choice. Attaching a link below which goes through the steps and which also shows image of window where you can make the selection (figure 11).
Getting Started with C++ for Eclipse - CodeGuru
When Eclipse doesn't detect a toolchain (to be installed separately) it only offers the option "Cross GCC". Don't choose that.
Sites like this tell you that a properly installed toolchain (Cygwin / MinGW) is automatically discovered using the PATH environment variable. This is not the case on my machine.
There's no way to configure a toolchain in Eclipse manually (as of writing) but you can fool Eclipse into finding one without changing your global PATH:
Go to Preferences/C/C++/Build/Environment,
Add a variable PATH and point it to your toolchain path(s), e.g. d:\Mingw\bin;d:\Mingw\msys\1.0\bin. Separate paths with a semicolon.
For newbies just starting out C++ projects in Eclipse:
1 - Click File --> New--> C/C++ Project
2 - In the "Templates for New C/C++ Project" window, Select C++ Managed Build --> Click Next
3 - Provide a project name --> Select "Empty Project" in Project Type section (which is under Executable) and Select "MinGW GCC" in the Toolchains section
4 - Click Finish
Note: Selecting "MinGW GCC" will eliminate the headache of inputting the Cross GCC related prefix and path. Happy C++ learning.
enter image description here

Xcode C++ omp.h file not found

I’m trying to include openmp to my Xcode C++ project. I have changed my compiler in Xcode to LLVM GCC 4.2, added ”-fopenmp” as a CFlag and enabled OpenMP support in xcode as well. But it still says ”‘omp.h’ file not found” and i am unable to build the project. Does anyone know what could be wrong and how to fix this?
I have had the same problem. Try going to the project navigator using the panel at the left side. Select your project (the one with the blue icon), and a different main window appears. Here, click the relevant file under "Targets" and choose the "Build settings" and "All". Here, search for OpenMP. In my system, it shows up under "LLVM GCC 4.2 - Language". Set "Enable OpenMP Support" to Yes. This should make it work. Make sure to not manually #include "omp.h".
The weird thing is that I don't know how to do this "manually" (i.e. circumventing the built-in Xcode I approach described above).

Eclipse Helios-"cannot run program 'make' : unknow reason" on Mac OS X

I am a college undergraduate trying to learn C++ programming on my Macbook. It is installed with Mac OSX 10.7.3.
I have been trying to build the "hello world" project on Eclipse Helios, but after I clicked on the build project button, it keeps telling me "cannot run program 'make : unknow reason".
I noticed this post but it seems to be for the Windows OS instead of MAC OS, and I don't quite follow the instructions in it either (sorry I don't have any familiarity with programming...). The description for PATH variable is "not available" and I don't know if this is a problem. I'm also confused about what to put in the "Name" slot.
Edit:
Now after some trials I have "make" in my PATH. (i.e. the command line gives the information of the make after I input "make --version") and my PATH is set to
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin
However the same problem still persists. Can anybody please help? Thank you!!
My suggestion is to install Xcode (http://itunes.apple.com/se/app/xcode/id497799835?mt=12) from the App Stor (for Mac). Xcode is (free) developer tools supplied by Apple. After installing Xcode you can go to the menu 'Xcode' -> 'Open Developer Tools' -> 'More Developer tools' that will take you to apple developer site (where you probably have to register) and where you can download 'Command Line Tools for Xcode' that will contain make etc. for unix style development.
Xcode is quit nice and if there is no demand to use Eclipse when you could probably do well with Xcode.
EDIT: Undeleted this answer as it turned out to be correct.
Yes, I'd say that $PATH was the problem.
Your system default version of $PATH should be sufficient and if not then set it correctly in your .profile or .bash_profile. You'll need to logout and back in for these changes to take effect. Doing this will mean that you can compile from the command line without going into eclipse, which is something you'll want to do at some point.
Now simply configure eclipse to avoid setting any build variables and all should be well. Under Window > Preferences > C/C++ > Build > Build Variables, the list should be empty: