Right, this was fairly straightforward compared with Eclipse CDT! I will list the process I went through, rather than stating explicitly what must be done, as I may have been lucky the first time with certain things just working OOTB.
After installing NetBeans 7, I started a new project. I was immediately presented with mingw32 as a toolchain option. Whether this was because I’d previously installed it myself, or because it is part of the NetBeans for C++ installation, I don’t know, but I suspect the former. Selecting this toolchain, the project started and I had a simple Main.cpp file in place.
I moved the basic SDL setup code over from my Eclipse project. Now it was time to set up compiler and linker options. As in Eclipse, I right-clicked on my project in the Projects Panel, selected Properties… at the bottom and was presented with NetBeans’ considerably more compact Project Properties dialog: Specifically, the Build category.
First, C++ Compiler->General->Include directories — straightforward. Mine looked like
../../../libs/SDL-1.2.14-MinGW/include;../../../libs/SDL_ttf-2.0.10/include
I made sure the “Use Linker Libraries” option was checked. Under C++ Compiler->Command Line->Additional Options I set
-O3
(yes, with the hyphen) for highest level optimisation.
Next up was the Linker. This was incredibly simple, ultimately. Add your /lib subfolder within your SDL folder (wherever that is). After setting up using the ellipsis button provided, mine were:
../../../libs/SDL-1.2.14-MinGW/lib
Under Linker->Libraries, I added the two core SDL libs, which for SDL-1.2.14-MinGW, were
libSDLmain.dll.a, libSDLmain.a
…In that order in the pop-up dialog that appears when you hit the ellipsis alongside Libraries->Libraries. After exiting the dialog, these will appear as
SDLmain, SDL.dll
in Libraries->Libraries. Lastly, under Command Line->Additional Options, ensure you have
-lmingw32
(Again, with the hyphen.) You should find that this linker option will appear before your SDL linker options, when you try to run the app (provided the code is A-OK); indeed, this option MUST appear beforehand or you will get errors such as that SDL_Init cannot be found, issues with WinMain, etc. We’re done here, so OK the dialog to go back out into the IDE at large.
One last thing you need to do is to set up a run configuration. Once you’ve done so, attempt to run. Once compilation succeeds, NetBeans attempts to run the .exe and you should get an error asking you for DLLs. Go to your Files panel (should be on the left in default layout) and click the dist folder under your project folder. Locate your newly generated .exe therein, and place your SDL.dll in beside it.
You should now be up and running.
PS. If you are having troubles with your setup, (a) make sure you are using a minimal example as presented here, to start with (i.e. just core SDL and mingw32), and (b) be sure your linker flags are in the correct order, for all linked libraries.