[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.7.10 Creating an External MSVC Application

This HOWTO is a step by step guide for creating a Crystal Space application with MSVC outside the Crystal Space source tree. For the complete sample application in a zip archive see simple1.zip in the following directory:

`CS\docs\texinfo\tutorial\howto\msvcproj'

MSVC External Step 1

Open MSVC and click on New from the File menu. You will now be confronted with a dialog box for creating a new project.

tutorial/howto/msvcproj/snap0

MSVC External Step 2

Click on Win32 Application since `simple1' is a GUI application. If we were creating a Crystal Space console application we would use Win32 Console Application. Now enter the name of your application in the Project name text box. In this example, the application is named `simple1'.

Click OK and you will next be confronted with another dialog box.

tutorial/howto/msvcproj/snap1

MSVC External Step 3

Click on Finish and yet another dialog box will be presented.

tutorial/howto/msvcproj/snap2

MSVC External Step 4

Click on OK and we should now be in the MSVC IDE with our basic new Win32 GUI (Graphical User Interface) application project created and ready to be filled in.

MSVC External Step 5

Next, copy and paste the `simple1.cpp' and `simple1.h' from the Crystal Space code tree and paste them into the newly created `simple1' project directory. Thes files can be found here:

`CS/apps/tutorial/simple1'

Alternately, you could type in your own Crystal Space program, but for the sake of this tutorial, using the existing `simple1' application is simpler.

MSVC External Step 6

Now, in the left hand Workspace window, right click on the Source Files folder and then click on Add Files to Folder. Browse to `simple1.cpp' and double click on it and it will be added to the project. Do the same for `simple1.h' to add that file to the Header Files section.

MSVC External Step 7

Now configure the paths so MSVC can see both the Crystal Space include and library files. First, make sure that the simple1 files section is highlighted.

tutorial/howto/msvcproj/snap3

Next, from the File menu click on Tools, and then Options. You will be confronted with the Options dialog box.

tutorial/howto/msvcproj/snap4

MSVC External Step 8

Click on the Directories tab.

tutorial/howto/msvcproj/snap5

Use the browser to point MSVC at the CS\include directory. Next, click on the Show directories for drop-down list and select Library files, and point it at either of the two following directories, depending on what type of build of Crystal Space you performed.

`CS\mk\visualc\csdebug\bin\libs'
`CS\mk\visualc\csrelease\bin\libs'

Once you have performed these two action click on OK to exit back to the IDE.

MSVC External Step 9

Now, configure the individual and required build settings for Crystal Space. First, from the File menu, click on Project then Settings and you will be confronted with a Project Settings dialog box. Next, click on the C/C++ tab.

tutorial/howto/msvcproj/snap6

In the Preprocessor definitions text box replace its contents with the line below.

WIN32,_DEBUG,_WINDOWS,_MBCS,WIN32_VOLATILE,__CRYSTAL_SPACE__,CS_DEBUG

For a release build it is slightly different. See the attached sample application for what to insert in that case.

Next click on the Category drop-down menu and select Code Generation.

tutorial/howto/msvcproj/snap7

In Use run-time library change Debug Single-threaded to Debug Multithreaded.

Note: In a release build this is slightly different. See the attached sample application for settings in that case.

Next, click on the Link tab.

tutorial/howto/msvcproj/snap8

In the Object/library modules text box add the Crystal Space libraries as named below into the box with those already listed.

libcssys.lib libcsutil.lib libcsgeom.lib libcsgfx.lib libcstool.lib

These libraries are needed to successfully link the `simple1' application, though other libraries are also available. You can examine other existing Crystal Space applications to see which other libraries and features are available.

Finally, click on OK to return to the IDE and then build the project.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html