Run C++ on MacOS without xcode - c++

I don't have Xcode installed on my Mac OS 13.6 but I would like to run c++ on vs code. Is there a way to do that without the need for Xcode to be installed? Also, can I run an older version of Xcode and run c++ without problems?
Note: Would be great if someone posted a link for a tutorial.

You may download and install LLVM 13.0.1 for Darwin or a small part of Xcode, Xcode command line tools: xcode-select --install.
Both will result in installing clang++.

Related

Install an old version of MinGW GCC

I need to compile the source code of an application that was successfully compiled using MinGW GCC 4.8.1 the last time. I tried to use the most recent version of the compiler that is available in the MinGW Installation Manager but it doesn't work.
I would like to install the 4.8.1 version but I can't find it in the packages of the Installation Manager. I tried to install it using the command line in windows after adding MinGW to Windows'
mingw-get install "gcc=4.8.1"
But it doesn't work either, some packages seem to not get found by the program and it looks like it's installing the most recent version...
Is there a way to install GCC 4.8.1 on Windows as of today ? I'm on Windows 7 pro and I'm on my computer at work so I can't go too deep in the folders and I don't have administrator rights for everything.
Thanks for your help

How to update the clang version to compile a C++11 project? (on Mac)

I'm trying to build a project which is originally written for archlinux. The building process works fine on that archlinux but has a huge amount of errors when I tried to build it on my mac. The project is basically written in C++11 so it's very unstable. I think there has something to do with the compiler because the clang version in mac is 4.2(It actually shows 'Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)' when I type clang --version) and 3.3 for linux. So I want a different version of clang, perhaps 3.3. How Can I specify the version of my compiler when trying to build the project?
Some might argue this belongs on apple.stackexchange.com, but I'm not sure C++11 tags grab a lot of attention there:)
Xcode 5.0 is now available from the App Store. Install it, go to Preferences -> Downloads, and install the Command Line Tools. However...
First, you will need to go to Preferences -> Accounts and add your Apple ID. For some reason, the Command Line Tools download requires an account login. I don't know what the rationale for this is.
> clang -v
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
If you are willing to build from the command line, using make for example (which sounds likely given the project is from Linux), then install Macports and install whatever version of clang you would like:
$sudo port install clang-3.1
$sudo clang_select
Note that this version of clang shouldn't interfere with the Xcode Command Line package if you are will to invoke the Xcode version using xcrun clang instead of plain old clang.

Can I use gcc 4.7 (and C++11) on Mountain Lion without installing XCode?

I've been using command line tools and a text editor to compile class projects, which has worked great. Unfortunately, they've become sticklers about us using 4.7. Xcode (and thus OSX) only has llvm-gcc 4.2, so I was looking to upgrade.
I've got macports installed and have found instructions for installing gcc 4.7, but it says that I need xcode installed. I was hoping to be able to just use command line tools and not have xcode (I don't need any of the iOS or graphics stuff, I just want gcc.
Anyway, if it's not possible, it's no big deal, but I'd be appreciative if anyone could point me in the right direction. Thanks!
To clarify, I have command line tools, but not the version of gcc I'd like. Running macports results in this:
$ sudo port install gcc47
Error:
Error: No Xcode installation was found.
Error: Please install Xcode and/or run xcode-select to specify its location.
Error:
Error: The installed version of Xcode (2.0orlower) is too old to use on the installed OS version.
Version 4.1 or later is recommended on Mac OS X 10.8.

C++ Programming on a Mac

I have installed Xcode 4.0 (XCode Toolset, System Tools and Documentation components only), but have Netbeans with the C/C++ plugin. However when I try to create a new C++ project in Netbeans it tells me that no compiler was found on my system. The recommended course of action is to install Xcode, which I have done so.
How do I get Netbeans to recognize that I already have Xcode?
Most likely, you reinstall Xcode and this time don't uncheck the option that installs the compiler, etc. under /usr/bin for command line use. What's wrong with just having a full installation of Xcode?
If that doesn't work, it may be an incompatibility due to Xcode 4 installing to /Xcode4 instead of /Developer. You can fix that with a symlink or by installing Xcode 3.

"Hello World" fails to run. Eclipse (Galileo) CDT plugin problems with MinGW and Cygwin on Windows Vista

Trying to run a simple Hello World C++ program on Eclipse (Galileo) CDT plugin on Windows Vista. Following the "Before You Begin" instructions for Eclipse/CDT...
1) Downloaded and installed the latest Cygwin. However, could not compile with Cygwin.
Internal Builder: Cannot run program "g++": Launching failed
the Eclipse CDT docs say...
currently Cygwin >= version 3.4.4-999 is not supported since gcc and g++ commands cannot >be launched from the windows' native shell
It seems to be a typo (Cygwin version is at 1.7.7) but running cygcheck -c, I get the version of g++ which is 3.4.4.x.
Hence I assumed that this version of g++ cannot be run from the command line. So gave up on Cygwin.
2) Downloaded and installed MinGW, gdb, MSYS.
This time, it was able to compile, but when trying to run, I get a popup saying that
the program Hello.exe has stopped working
You should use either Cygwin, or Mingw, because their dll's might conflict if they're both discoverable via %PATH%.
Show your build process (copypaste text from your build console) and %PATH% contents.
The simplest solution was to install the latest Eclipse (Helios SR1) and the CDT plugin.
I needed to also delete the old projects/import old source into new projects.
For Galileo, see:
http://sourceware.org/ml/cygwin/2010-03/msg00510.html
http://dreamlayers.blogspot.com/2010/01/eclipse-incompatibility-with-cygwin-17.html