Compiling a plugin with Visual Studio 2005
From LightWiki
I wrote this tutorial because I couldn't find any simple explanation of how to set up Visual Studio 2005 to compile source from the LightWave SDK.
Tutorial
1.To compile a plug-in with Visual Studio start a new Win32 project and make it an empty DLL:
2.Add your source files as well as servmain.c, shutdown.c, startup.c, and username.c(these can be found in [Drive:]Program Files\[Appropriate LightWave directory]\SDK\source\):
3.To add the LightWave include directory you can go to Tools->Options which will open up the Options dialog and from here expand the "Projects and Solutions" tree and then click on the "VC++ Directories" branch. From here change the "Show directories for:" pop-up menu to "Include files":
4.Then you click the new line button and enter the directory for the LightWave include files or you can browse for it, now you won't have to worry about the include directories unless you reinstall Visual Studio or clear the include directories:
5.Now go to Project->Properties and this will open the project properties page. The first thing you need to do here is change the configuration type to "All Configurations":
6.From here expand the C/C++ tree and click on the "Preprocessor" branch. Add _X86_ and _MSWIN to the "Preprocessor Definitions" field(separated by a semicolon):
7.Then you click on the "Advanced" branch and change the "Compile As" field to "Compile as C Code (/TC)". NOTE:If you want to compile your source as C++ code leave this at its default value, plus you have to add some additional code in your source not covered by the SDK, there are a couple of good tutorials on the web that cover this though:
8.This step is not necessary as LightWave can use a .dll file just as well as a .p file, but just for conformity I change this anyway. Expand the "Linker" tree and click on "General". You can change the extension of the file in the "Output File" field to .p to get the compiler to save the DLL with a .p extension:
9.If you decided not to do the last step go ahead and expand the "Linker" tree now. Click on the "Input" branch and type or paste the path to the serv.def file which can be found in the LightWave source directory in the "Module Definition File" field:
After this just click "Apply" and you're ready to compile!


