PDA

View Full Version : VC++ .net 2003 Help Me! - Please



MiniFireDragon
09-16-2007, 06:47 PM
I have spent the past week searching google, lightwaves forums, Aura's site and Catalyst's site on how to set up a project to build plugins. It seems no matter what I do, I either get the plugin won't load in modeler (using the samples in the SDK) or I get loads of linker errors.

The SDK solution in the SDK is only for VC++ 2005 so it won't open, and all the tutorials are written for VC++ 6! This is really gotten me fustrated as I followed everything laid out in the SDK compiling docs as well. So I am asking someone to please post either the settings or a template file. The yahoo lightwave plugin forum has a download, but it is corrupt or something, neither WinRAR or Winzip 11 recognize it or repair it.

I also change the complilation type to C instead of C++ (thanks Aura for pointing out the changes you need to make to the code to make it compile in C++, it is this that led me to change it to C).

jameswillmott
09-16-2007, 07:08 PM
Can you post the linker errors you're getting? Did you remember to define _MSWIN in VC Express? (If you're on Windows)

MiniFireDragon
09-16-2007, 09:03 PM
I got it going now. I started from Zero. Deleted everything, then opened up the SDK Compiling document and did the server.lib file as it specified. There is something that needs to be changed in the document, something that really isn't said anywhere, but I will get into that in a second. This is the way to generally setup MSVC++ .net 2003, both building the server.lib and the actual plug in file.

Server.lib>

Click>New Project
Click>"Visual C++ Projects"
Click>"Win32"
Click>"Win32 Project" in the Right Window

In the name field enter: server

Click>"OK"
Click>"Application Settings"
Click>"Static Library" Radio button

Now this is important!! NO NOT UNCHECK PRECOMPILED HEADER
If you do, you will not be able to change the nessecary settings needed to compile. This they don't tell you about. I found it looking through tutorial pictures.

Once the project opens, right click on "server" (the one that doesn't have solutions in it's name)

Set Configuration to "All Configurations"
Click>C/C++ Folder
Click>General
In the "Additional Include Directories" Add the path the SDK Include directory, this is the only window that will let you browse to the folder.

Click>Preprocessor
In the Preprocessor Definitions type> _X86_;_MSWIN

Click>Precompiled Headers
Change Create/Use Precompiled Headers to "Not Using Precompiled Headers"
This is important!! I was having problems compiling until I set it this way, and I found this out looking through

http://www.catalystpics.co.uk/lwp/lesson1.htm

Click OK

Now goto the SDK Source Directory and Highlight, Right Click and Copy these files: servdesc.c, username.c, startup.c, and shutdown.c

Go back to VC++ and right click on "Source Files" and click paste
This will add them to your project.

Click>Build>Build server

This will create a debug version of the server.lib file.

Right Click>server (not the one that says solution)
Click>Configuration Manager
Change "Active Solution Configuration" to "Release"
Click>Ok
Click>Build>Build server

This will create a release version of server.lib

Now for your plugins>>>

Click>New Project
Click>"Visual C++ Projects"
Click>"Win32"
Click>"Win32 Project" in the Right Window

In the name field enter the name of your plugin

Click>"OK"
Click>"Application Settings"
Click>"DLL" Radio button
Make sure "Empty Project" and "Export Symbols" is NOT CHECKED

Once the project opens, right click on the name of your plugin (the one that doesn't have solutions in it's name)

Set Configuration to "All Configurations"
Click>C/C++ Folder
Click>General
In the "Additional Include Directories" Add the path the SDK Include directory, this is the only window that will let you browse to the folder.

Click>Preprocessor
In the Preprocessor Definitions type> _X86_;_MSWIN

Click>Precompiled Headers
Change Create/Use Precompiled Headers to "Not Using Precompiled Headers"
This is important!! I was having problems compiling until I set it this way, and I found this out looking through

http://www.catalystpics.co.uk/lwp/lesson1.htm

This next piece of information is not listed in the compile directions of the SDK, or atleast I never found it. Well, I found some vague reference to putting something in the link properties, and by digging through the lw-plugin user group I found this:

In Project Properties->Linker->Input->Module Definition File, add
the path to the serv.def file.

The SDK says to add the serv.def file to the source files, this is pointless, as it does nothing but make you want to scream when it doesn't load into Lightwave correctly.

The only thing left to do is open the SDK Source directory, highlight servmain.c and right click and click copy

Go back to VC++ and right click on "source files" and click paste. Do the same with server.lib. Besure to change it when do your release build.

This is the way I figured out how to do it, and now I have a record of where to find it when I forget what it was I did, and hope this serves as a suitable replacement for splinecages explanation which no longer exists in cyber space, or atleast none that I could find.

MiniFireDragon
09-16-2007, 09:04 PM
If there is a problem with these directions let me know. I tried to repeat what I did, but didn't test it completely word for word above.

Mr Big
06-17-2009, 08:37 PM
Just tried your directions in VC++ 6.0, & the directions worked perfectly with the latest SDK. Thank you very much for your hard work MiniFireDragon. The only difference between the instructions for 2003 & version 6 is the serv.def file works when included in the source files.