VCC4N (Visual C++ Compiler For NetBeans) is a plugin used to compile C/C++ code in NetBeans IDE with Microsoft Visual C++ compiler.
It provides a toolchain and an intermediate program called "msvc_caller.exe" used to call external compiler and linker.
The actual release is a beta version, but allows you to compile full projects (application, static library, DLL) in 32/64 bits.
This version is compatible with NetBeans 8.0 and 7.3+.
No debugger is supported yet.
If you have any questions or feedbacks please post on the forum.
You must have Microsoft Visual C++ installed. This plugin works with Visual C++ 2010 and higher (including Express), and should work with older versions.
You also need MinGW and MSYS make.exe because projects are still built with Make files.
For more information about how to install them, visit http://netbeans.org/community/releases/72/cpp-setup-instructions.html
To install VCC4N, download the latest release, then extract it in the folder of your choice. This folder will be used with NetBeans, so it must stay in place in the future. Do not rename the "tools" folder. Make sure files have read/write permissions.
If you have a previous version of VCC4N installed, it is safer to uninstall the plugin from NetBeans and reinstall it. Also, remove the old "tools" folder and use the new one.
In NetBeans, install the plugin as follow:
- Tools > Plugin
- Downloaded tab
- Press "Add Plugin..." and select "VCC4N.nbm" from the extracted folder
- Then press "Install"
- You must restart the IDE
When restarted, create the toolchain:
- Tools > Options > C/C++ (Build tools tab)
- Press "Add..."
- In "Base directory" select the "tools" folder you have extracted before
- (VCC4N must appear in the fields below)
- Press OK
- Then, as asked, select your Microsoft Visual C++ Folder (or keep the existing one).
If everything goes right you will see "msvc_caller.exe" in C and C++ compilers.
This file will work as an intermediate between NetBeans and Visual C++ compiler/linker.
To build static libraries you will need to use msvc_caller instead of ar.exe:
- In Project Properties > Archiver
- Uncheck "Run Ranlib"
- In Tool, replace "ar" with "msvc_caller"
That's all, now you can use VCC4N as a compiler in your project.
The following notes are available in your project's properties.
Additional optionsfield, do not start them with a
'/'as usual, but use a
'-'instead. This is because the
make.exewill recognize any arguments starting with a slash as a path and will convert it to something like "C:/MinGW/bin/option". The '-' will be converted and treated as an argument by msvc_caller.
You may know that Visual C++ add several options by default to the compiler, which are not in NetBeans, like preprocessor values. Here are some example, but check the options you need to compile your project:
-D"_WINDOWS" or -D"_CONSOLE"
-D"_USRDLL" -D"MY13_EXPORTS" -D"_WINDLL"
/ALLOWISOLATION /MANIFEST /ManifestFile:"Release/YourFile.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'"
Msvc Caller contains some options in the "msvc_caller.conf" file.
vcbinis the Visual Studio path used to call compiler and linker. You can change them here, but it is filled by the plugin when you select the folder.
addCompileArgsare arguments added to the compiler each time is called. These are default options used in Visual Studio, but you can change it or add more if you like.
addLinkerArgsare the same for the linker
verboseis used to display information about compiler/linker calls. You can turn it on if you have unknown compilation errors or if you want to know the full command line used.
The "msvc_env.conf" is automatically generated and contains the environment variables needed to run the compiler/linker. They are generated using the batch named "vcvarsall.bat" in Visual Studio.
An intermediate executable called
msvc_caller.exe is used by the module instead of the Visual C++ compiler. This choice has been made to bypass some issues due to NetBeans toolchain structure or the usage of make. This is of course not the best solution, but probably the easiest and fastest to get something working.
The first problem is that NetBeans does not allow to use different programs to compile and link. Unfortunately unlike gcc, Visual C++ use two programs cl.exe and link.exe (you can do all with cl.exe, but not separately like in make builds).
Another problem is the usage of make via MinGW which converts all the commands from POSIX to Windows style. Unfortunately all the compiler options in Visual C++ start with a slash and can contain path (like object output /Fo). The make will convert the paths using a POSIX conversion which does not work well all the time (especially when using path in options like
/Fo"D:/programs/folder with space"
These are the main reasons of using an intermediate program, but there are some others which make this way easier, because we can control all the inputs and eventually convert them to fit the compiler requirements. Another solution would be not to use the NetBeans toolchain and write a complete separate plugin, but this is a huge job.
Log in to post a comment.