C++ Programming on a Mac - c++

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.

Related

C++ OSX Setup w/ Vs Code or?

I have to use c++ 11 for class and I was wondering how I go about setting that up on a MAC? I need to be sure it is specifically c++ 11 or I will fail.
I liked the themes in VS Code and would like to do it with this program, but I am open to suggestions.
One answer would be to use Xcode, but personally I use Atom as my text editor and have several different compilers installed.
You will most likely need to install Xcode just for the build tools that come with it. You could install GCC or Clang via Homebrew or a package manager of your choice.(Yyou will need a working C++ compiler to install Gcc or clang via homebrew)
My suggested course of action would be to:
Install Xcode (From Mac App Store)
Install Homebrew(optional)
Install GCC and or Clang (optional)
Install a text editor like Atom or VSCode
The latest versions of GCC, Clang And Apples LLVM compiler will be able to compile C++11 and C++14.
If you choose to go with Atom, VSCode, etc... you will need to learn how to compile from the command line or use Make(Which is what I usually do)
It sounds to me like you go to a school that uses MS Visual Studio and you are seeking a replacement? If so you may run into trouble down the line not having Visual Studio. If your courses are going to be using Visual Studio I might suggest Dual Booting your Mac with Windows and Installing Visual Studio on there.(Though you will need copies of each, but your school may provide. Mine did) That is how I got through most of my programming classes that depended on Visual Studio.
EDIT:
Additionally you will need to make sure that you have make installed on your system. Try running make -v from your terminal. If you get command not found you will need to install it, it comes with Xcode or you can install it via Homebrew.

How do I need to configure Eclipse to create a C++ program?

I installed Eclipse for C/C++ Developers.
After installing it I also installed PyDev.
I managed to create a C++ project (The Hello World project that comes with it). But I cannot compile/run it.
When I created the project there was nothing in the toolchain list. So I think I will need to install a toolchain. But I cannot find anything. I need someone to help me with this please.
I am using 64 bit Windows 7.
No compiler, no executable.
Check MinGW
This is one of the first results i got in google for eclipse and mingw:
http://max.berger.name/howto/cdt/cdt.jsp
You need to install not only Eclipse CDT, but also a C/C++ compiler for Windows, like minGW.
Try installing TDM-GCC from http://tdm-gcc.tdragon.net/ . This should have you up and going with a compatible GCC setup under Windows in a snap.

Making Eclipse for C++ developers compile

I've downloaded Eclipse for C/C++ for Mac OSX. I'm running Snow Leopard. Now, when trying to run the Hello World application on Eclipse, it is complaining that
What might be the issue? Maybe I don't have (or Eclipse can't find) where my C++ compiler is? If that is the issue, what should I install and how should I proceed so that Eclipse recognizes it?
It looks like gcc is not in your path. Try adding the path to gcc (should be in /usr/bin by default) to your PATH environment variable and relaunch Eclipse.
You can also try adding it to Eclipse's preferences. I believe you'll find an item in the eclipse preferences which will allow you to point eclipse at the location of gcc. This would come in handier then benw's answer in my opinion because you're not changing anything with the system itself. Developing often involves setting things up specific to your development environment. Although it seems like gcc would be on your PATH already if it were installed. Have you installed Apple's developer tools by any chance?
Thanks.
Since I cannot comment on that comment you just put above. Install the Apple Developer tools. You can go here to download them. I just used gcc on my work mac today, and I never installed gcc specifically so it had to have been installed when I installed the developer tools.

Eclipse Ganymede and MinGW in Windows

I'm trying to get eclipse to work with MinGW.
I've done the following:
Downloaded CDT for eclipse.
Installed MinGW.
Added C:\MinGW\bin to my path.
Opening a command prompt (CMD) and typing g++ or alike works fine.
I run eclipse, create a "New C++ Project", and only get the option saying "other toolchains".
There's a MILLION tutorials out there saying eclipse should identify MinGW on its own. It doesn't, and I don't know what to do. I've tried reinstalling everying in just about every order posible. Still no luck.
I've also noted some tutorials say something about creating a "Managed C++ Project". I've no such option, all I get is "C++ Project" and "C Project"
edit:
I have eclipse ganymede, windows x86_64, version 3.4.2
http://download.eclipse.org/eclipse/downloads/drops/R-3.4.2-200902111700/index.php
Running the "Eclipse IDE for C/C++ developers" fails, since there's no x64 version for windows. The x86 version requires x86 JAVA installed as well, and installing two versions of java, gave nothing but trouble in the past.
The instructions for setting up MinGW in Ganymede are located here.
The following are instructions and
links on how to install the current
version of MinGW. Note that these
links may become inaccurate over time
as new versions of MinGW components
are introduced. Please check the MinGW
File Release section for the latest
versions.
Download and run the MinGW setup program, MinGW-5.1.3.exe.
Select download and install the MinGW base tools and the g++ compiler.
You may select the Current or
Candidate version of these tools. You
may also install any of the other
available compilers as well.
Do not install the MinGW Make feature as the MSYS version of make
from step 5 is a more complete
implementation of make.
The MinGW setup program currently does not install the gdb
debugger. To install the debugger,
download the file from the following
location: gdb-6.6.tar.bz2
Extract the contents of the file gdb-6.6.tar.bz2 to the same location
where you installed MinGW.
If you want to use Makefile projects, download and run the setup
program from the following location:
MSYS-1.0.10.exe. MSYS provides an
implementation of make and related
command line tools. This is not
required for other types of projects
with the MinGW toolchain, which use
CDT's internal build tools to perform
the build.
Following this process resolved any problems I had.
I had the same exact problem with Eclipse Galileo and CDT 6.0.1. It turns out that CDT only recognized MinGW when it's located under c:\mingw. I had it in c:\msys\mingw so that was the problem. After I changed that everything worked fine.
The distinction between managed make projects and makefile project was removed in CDT 4.x, I think. Now there is only one type of project, but you can select different builders. CDT includes an internal builder which does not use makefiles and another one which does.
First, save yourself the effort of "reinstalling in every order possible". That is also known as trial-and-error, and will only make you more frustrated. Apply the normal problem-solving skills you have as a programmer.
Given that you have MinGW installed, what happens if you download "Eclipse IDE for C/C++ developers", start eclipse.exe, and try to create a C++-project with a MinGW toolchain?
EDIT: remember: the key in getting help with problems like these is to produce a minimal example which fails. Also, it would help if you provided URLs to the packages you installed (MinGW, Eclipse, etc.).
EDIT: I just installed CDT using the Ganymede update site, downloaded and installed MinGW from here, and restarted Eclipse, and everything worked fine. I know that doesn't help you, but it does prove that the toolchain detection isn't completely broken. Something is weird on your side.
You could try Wascana Desktop Developer. Its a distribution of Eclipse CDT configured specifically for developing on Windows.
I had the same problem (i.e. Eclipse not finding MinGW on the PATH) after I removed some of the unused files/folders from MinGW. It was ~600 MB and I was tasked to trim it down before adding to source control. I got it down to a workable ~200 MB. When I tried to re-create an Eclipse workspace afterwards, MinGW disappeared from available toolchains. It reappeared after I put the original MinGW install on the path.
HTH

How to configure Eclipse with CDT?

I've been trying to use CDT with Eclipse 3.4 under Windows XP with cygwin.
What do I need to do, in order to get startet?
I used "eclipse-cpp-ganymede-SR1-win32.zip" found on the Eclipse homepage.
Edit:
The main problem is, that I cannot compile and run the code.
In the run configuration, I tried gcc.exe for the C/C++ Application:
After adding the path of make.exe to my $Path, and starting from scratch, it works perfectly.
I finally found. Thanks guys.
After downloading and unpacking "eclipse-cpp-ganymede-SR1-win32.zip", you need to install either Cygwin or MinGW.
Make sure the compiler (e.g. gcc.exe) and make.exe is on your $Path.
Start Eclipse and everything should work fine.
If you want to use Eclipse/CDT on Windows, you should consider using Wascana Desktop Developer, a CDT distro specially targeting Windows hosts.
According the the CDT Downloads page:
As a minimum, you need to install the Eclipse Platform Runtime before installing the CDT
So adding the CDT Ganymede update site to your current eclipse 3.4 configuration should be enough for you to install CDT.
After that, do you have any error message ?
For instance, there can be some eclipse.ini-related issues when using this package.
For me the package you downloaded worked from start. However I was using it with MinGW instead of Cygwin.
I am using it also for QT4 development together with QT Integrator.
I use MinGW, though I note that the documentation says you can use Cygwin. I would have a look through Max Berger's CDT guide to troubleshoot the problem.
you can install both Cygwin and MinGW in your system. gcc and make available with Mingw seems to be suitable better for native windows build. If the PATH environment is set to paths of Cygwin [and/or] MinGW Eclipse project wizard asks you select one . Either Cygwin or MinGW.
For MingW, you may need to download gdb as well, if you need to debug your application