Reputation: 3824
I am totally new to C/C++ IDEs under mac os x, thus to netbeans. I downloaded the C/C++ dmg, under max os x 10.10.5.
I have built gcc-6.0.0
(dev version) from source and it works like a charm on the command line. I intend to use it with netbeans, so in netbeans preference, I created a new "tool collection" called "gcc-6.0.0" that I filled inspiring from the two default already available (called GNU and clang) after installation of netbeans. I've filled as follows :
/usr/local/GNU/gcc-6.0.0
/usr/local/GNU/gcc-6.0.0/bin/gcc-6.0.0
/usr/local/GNU/gcc-6.0.0/bin/g++-6.0.0
/usr/local/GNU/gcc-6.0.0/bin/gfortran-6.0.0
/usr/bin/as
/usr/local/GNU/make-4.1/bin/make-4.1
/usr/local/lvm/cmake-3.3.2/bin/cmake
Note that my gcc commands (gcc, g++ and gfortran do have prefixes, it is not an error.) As I have built make and Cmake from source, I filled paths to their respective binaries also.
Note that in the add new tool collection windows, for "base directory" I have put : /usr/local/GNU/gcc-6.0.0
and was told (by a red message a the bottom of the new tool collection window) that "no compiler sets were found in the directory /usr/local/GNU/gcc-6.0.0
'... Same message if I put /usr/local/GNU/gcc-6.0.0/bin
instead...
Finally, I choose a welcome project template (for which I choose the newly created tool collection), and I build it, and have this console output :
cd '/Users/XXXXXXX/Documents/Welcome_1'
/usr/bin/make -f Makefile CONF=Debug
"/Applications/Xcode.app/Contents/Developer/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/Applications/Xcode.app/Contents/Developer/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU_1-MacOSX/tmp14
mkdir -p build/Debug/GNU_1-MacOSX
rm -f "build/Debug/GNU_1-MacOSX/welcome.o.d"
g++-6.0.0 -c -g -MMD -MP -MF "build/Debug/GNU_1-MacOSX/welcome.o.d" -o build/Debug/GNU_1-MacOSX/welcome.o welcome.cc
/bin/sh: g++-6.0.0: command not found
make[2]: *** [build/Debug/GNU_1-MacOSX/welcome.o] Error 127
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 221ms)
How come /bin/sh: g++-6.0.0: command not found
when I don't have any issued like this one on the command line, and when I gave paths to g++-6.0.0
in the new tool collection windows ?
How can I achieve what I intended to do, that is, using my gcc-6.0.0 gcc/g++ compiler with netbeans ?
Thx in advance !
Upvotes: 0
Views: 1745
Reputation: 59
I had this same problem, and I may have found a workaround that sort of turns into a permanent fix. Try opening NetBeans from your Mac terminal and you should be able to compile C\C++ applications. Here are the steps:
Open the terminal by holding down the cmd key + space bar to get your Spotlight Search, then type "terminal" and hit the Return key.
In the terminal, type in the following command to open your .c file for example. (Here you're concatenating two commands in the terminal):
open /Applications/NetBeans/NetBeans\ 8.2.app/ && /Applications/NetBeans/NetBeans\ 8.2.app/Contents/MacOS/netbeans --open /Users/macbook/NetBeansProjects/CprogrammingChap1/main.c
For "/Users/macbook/NetBeansProjects/CprogrammingChap1/main.c" you would replace this with the file you want to open.
Under the Netbeans 'Run' heading choose 'Compile File', and the file should successfully compile.
I've found that when you close NetBeans and reopen it from the GUI (just double clicking on the icon), the C/C++ files compile normally.
Upvotes: 0
Reputation: 3824
Putting /usr/local/GNU/gcc-6.0.0/bin
for "base directory" instead of /usr/local/GNU/gcc-6.0.0
made my day, even if there still is the "no compiler sets were found in the directory" red message in the "new tool collection" window.
Upvotes: 1