[TUTORIAL] Setting up Netbeans 8.2 to develop dll

Anq

Prince
Joined
Apr 14, 2019
Messages
351
Location
Anser (geese) HQ
Netbeans is a cross-platform IDE written in Java. Up to version 8.2 it has a C/C++ IDE. It has support for GNU C compiler out of the box, and Microsoft Visual C++ compiler through a plugin called VCC4N.

However, since the Visual Studio debugger is proprietary software, Netbeans does not provide a debugger that can be used for our project, and no plugin offers that debugger either.

<For debugging, you can easily use Visual Studio Code with the Microsoft C++ extension.>

====Common files for compiling the DLL====

Visual C++ Toolkit 2003 - (not downloadable from Microsoft, hosted on CivFanatics site)
Install Visual C++ 2003 Toolkit: you can find it under C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\
Download my package VC2003-additional-files.zip, which contains bin\cvtres.exe and bin\nmake.exe (both ripped off from a Visual Studio 2003 installation), lib\msvcrt.lib, lib\msvcprt.lib, and a last file vcvarsall.bat intended for VCC4N, which is a clone of vcvars32.bat. Extract this package to the path above.

Windows SDK - for Windows Server 2003 sp1 (downloadable from Mircosoft as PSDK-x86.exe or PSDK-amd64.exe depending on your machine.)
Download my package Microsoft Platform SDK trimmed and unzip it to C:\Program Files\Microsoft Platform SDK\
I trimmed this package based on the one A simple guide to compiling the DLL provided, which was ripped off from a Visual Studio 2008 installation and was actually a Windows Vista SDK. It is unusable.

Additional files needed in your Caveman2Cosmos\Sources directory
Download this file fastdep.exe and place it in Caveman2Cosmos\Sources\bin
Download this file MakefilePaths and place it in Caveman2Cosmos\Sources
Open MakefilePaths with a text editor, and edit the TOOLKIT, PSDK, CIVINSTALL variables to reflect your VC++ Toolkit 2003, Windows SDK, and BtS installation paths, respectively.

====Setting up Netbeans IDE====

Download Netbeans IDE 8.2 (choose the C/C++ edition) from the official site.
Java is required on your machine.

Download VCC4N here and unzip it to a permanent location.
Find the file msvc_caller.conf under VCC4N_0.5\tools and open it with a text editor. Fill that line:
vcbin=C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\​

And then you can launch Netbeans IDE and add this plugin following the instructions on VCC4N wiki.
Edit the tool settings for VCC4N. You need to direct it to use the nmake.exe from the Visual C++ Toolkit as the Make Command.

====Project setup====

For C2C, you can open this project by navigating the file chooser window to Caveman2Cosmos\Sources.

For other mods, you create a [New C/C++ Project with Existing Sources], open your source folder, and choose the VCC4N tool collection. It's up to you to configure your project later.


====Problems====

1. You cannot use a debugger in Netbeans.
2. On the built-in SVN support:
Although it is convenient to have svn support in the IDE to view the history of source files and so on, it also causes problems when you try to use TortoiseSVN to change files.
Netbeans scans the folder continually. When the two SVN programs are run at the same time, frequently you're going to see the SQL database locked up. If this happens, you need to clean up the working copy status to continue your work.
Therefore you should make sure to disconnect in Netbeans before you switch to your Explorer to do most TortoiseSVN actions.​
 

Attachments

  • VC2003_additional-files.zip
    242.4 KB · Views: 166
Last edited:
Fascinating. What would you say are the benefits of using Netbeans over VS?

And this doesn't mean we HAVE to switch over, right? I might test it out a bit at some point and maybe I'll like it more but I'm hoping it's not compulsory.
 
Last edited:
One advantage is it reads boost and python headers fine, although in our dll source code it can mark normal things as error when a file is open. Notable cases include DllExport prefixed functions, and the DllMain entry point, but they are generally limited and do not propagate to make the rest of the files unreadable.
I've since moved the xerces source folder to branch and left only header files to accelerate its reading. Its analysis tools have been reliable after digesting all the headers.
 
Last edited:
There's no debugging support for msvc in NetBeans that's a huge disadvantage.
 
Top Bottom