Skip to main content
gamedev.net
🔒 Locked

Multiple projects in a solution

Started by Nixsos 0 replies 850+ views
Original Post
Nixsos
Nixsos
I'm currently working on a generic game engine and want to seperate the engine source from the engine testing code. So i figured i'd just add another project to my solution. I did just that and added the directory with the engine source files and headers to the test project's 'Additional Include Directories'. When i try to build the test project, the compiler complains about unresolved external symbols. My guess is the linker can't find the source files of the engine. Does anyone know how to fix this?
Alan Kemp
Alan Kemp
What you probably want to do is build your engine as either a static library (.lib) or dynamic library (.dll). I would suggest starting with a static library.

I dont know what compiler/ide you are using, so I will assume some form of Visual Studio. Setting are similar for other as well so you should be able to adapt this.

Start a new win32 project, set the type to Static Library (and chose empty project). Name it whatever you want to call your engine (lets say, EngineLib).

Add all your engine source to the project (you probably want to move the actual files into the new projects directory).

Now start another new project. Chose win32 application, and make select "Add to solution". Again name it, lets say EngineTest. Add your engine test code to this new project. Now in this new project, add the engine projects source directory to the additional include directories, and add the output directory for the EngineLib project to the additional linker path setting. Also add "EngineLib.lib" to the additional libraries on the linker settings.

You should also set the test project as being dependant on the enginelib so if you make any changes everything that needs to be rebuilt gets built automatically. Right click onj the test project and select "Project Dependancies", check the box next to enginelib. Now make sure that the test project is the active project (right click, "Set as startup project") and build it, it should automatically build the engine and link it to the test project.

Sorry this explanation is a little wordy. If you are having problems I would highly recommend starting with some really simple code (say a static library with one function and a test program that calls it) to make sure you have everything set up properly.

I hope thats of some help to you,

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.