Results 1 to 8 of 8

Thread: Compiling a plug-in with Visual Studio 2005

  1. #1
    Registered User ShawnStovall's Avatar
    Join Date
    Nov 2005
    Location
    MI
    Posts
    1,229

    Compiling a plug-in with Visual Studio 2005

    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 tutorial 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!
    Triboot-

    XP:Work, play, ect.
    Vista:... I don't know.
    Ubuntu: Developing on Linux also...

    Pentium 4 2.8 GH
    GeForce 7600 256 MB AGP 8x
    Driver:163.75(WinXP)
    1 GB RAM

  2. #2
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,300
    great,

    thanks to this simple explanation I got my first plugin compiled in 1 hour.
    I did it in VS2008 and it works in exactly the same way.

    creacon

  3. #3
    holy **** that's brilliant. very cool Shawn.

  4. #4
    Super Member COBRASoft's Avatar
    Join Date
    Dec 2005
    Location
    Oudenburg, BEL
    Posts
    3,179
    Now that's a handy tutorial

    Great work

  5. #5
    Registered User ShawnStovall's Avatar
    Join Date
    Nov 2005
    Location
    MI
    Posts
    1,229
    thanks
    Triboot-

    XP:Work, play, ect.
    Vista:... I don't know.
    Ubuntu: Developing on Linux also...

    Pentium 4 2.8 GH
    GeForce 7600 256 MB AGP 8x
    Driver:163.75(WinXP)
    1 GB RAM

  6. #6
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817

    Thanks!

    Thank you for taking the time to write this post, Shawn. I'm more afraid of compiler settings than I am of writing C code, so this information helps me a lot.
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

  7. #7
    Registered User ShawnStovall's Avatar
    Join Date
    Nov 2005
    Location
    MI
    Posts
    1,229
    Quote Originally Posted by Celshader View Post
    Thank you for taking the time to write this post, Shawn. I'm more afraid of compiler settings than I am of writing C code, so this information helps me a lot.
    heh, I didn't get into the SDK for months because of the compiler options. lol
    Triboot-

    XP:Work, play, ect.
    Vista:... I don't know.
    Ubuntu: Developing on Linux also...

    Pentium 4 2.8 GH
    GeForce 7600 256 MB AGP 8x
    Driver:163.75(WinXP)
    1 GB RAM

  8. #8
    Newbie Member falogfx's Avatar
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    55
    Sorry for digging up an old thread but I really need to say thank you for this tutorial!

    I've been trying for too many hours now to get the box1 sample to compile in Visual C++ 2010 Express, and with some efforts due to the different GUI in 2010 I finally succeeded to compile and run my very first plugin.

    I'm totally a beginner in plugin development and haven't got much experience in C/C++ either, although I've been writing some LScripts and done quite a lot of programming in VB, php, javascript and such.

    Now, just give me a couple of months and I should be able to make a load of boxes

    Thanks again!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •