- syntax highlighting
- code completion
- refactoring
- call graphs
In short, everything I expect from Netbeans when using Java. I am dealing with a large CMake based project, with existing sources. So I build the project manually, and CMake emits the Makefiles. Now I have a project that netbeans can open (an "existing Makefile based project"). The next thing you need to do is set your include directories (shown below).
Now this is where things get weird. Despite having set the includes several times none of the Code Assistance features worked. I tried deleting the NB cache, restarting, etc, etc. Nothing worked. If I write click on the project, and select Code Assistance I can dump the diagnostics. Notice how the user include paths that I entered ARE NOT PRESENT? WTF?
from project main [/Users/ghendrey/git/main]
Lang=CPP Flavor=CPP excluded=false
User Include Paths:
User Macros:
System Include Paths:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks
/Library/Frameworks
But, my user includes are not showing up! Finally, I tried Project > Properties > General and added my "src" folder to the "Project Source Folders". Now this seems like a bit of a "duh", but it wasn't obvious, since "." was already listed under project source folders, which presumably grabs everything. Furthermore, once I save the properties, and close the dialog, the "src" folder disappears, and only "." is shown. HOWEVER, it seems that adding "src" somehow kicked started the Code Assistance. Now I see the correct user includes when I dump the diagnostics:
from project main [/Users/ghendrey/git/main]
Lang=CPP Flavor=CPP excluded=false
User Include Paths:
/Users/ghendrey/splunk/current/include
/Users/ghendrey/git/main/src
/Users/ghendrey/git/main/src/libzero
/Users/ghendrey/git/main/src/util
User Macros:
System Include Paths:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks
/Library/Frameworks
And lo and behold, all of code completion is working. Incidentally, the Code Assistance right click menu is often broken (several of the items become unelectable until I close the project and restart netbeans). So, if you can deal with these annoyance, once you (finally) get up and running with code assistance in netbeans, it is a way way better c++ development environment than eclipse.