Jump to content
  • Advertisement
Sign in to follow this  
JNT

How to properly add existing projects in Visual Studio 2008?

This topic is 2686 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I recently wrote a software graphics engine in C++ and upon it's completion I wanted to create an application that actually uses the engine. Traditionally, I simply copied the .h and .cpp files that constituted the engine and simply put the copies in the folder where I had my source files that constituted the application using my engine. This is a very cumbersome method, since I couldn't easily modify the engine and have the changes apply to all of my applications using the engine. Modifying the engine meant that I would have to re-copy all files and put them in the respective source code folders for all applications using the engine.

I suspect that this is where adding existing projects to a Visual Studio 2008 solution comes in.

So basically the steps I have taken are:

1) Opening my graphics engine's solution and created a new project (let's call it "App" for simplicity's sake). The solution now contains two projects, my graphics engine project (let's call it "Gfx") and "App". "App":s physical location is specified so that the headers of "Gfx" are included by writing #include "../GfxHeader.h". Intellisense and compilation confirms that the headers are accessed correctly.

2) Opening the project dependencies of "App" and ticked the box that indicates that "App" depends on "Gfx" (note that omitting this step leads to the same result as in 3)).

3) I compile the solution and get linker errors, just as if I have forgotten to include (i.e. forgotten to Add -> Existing Item) the .cpp files of "Gfx" in my "App" project.

I should also specify that I am not looking to first build the "Gfx" as a DLL, but rather to being able to compile "App" as if all of the files of "Gfx" were included (i.e. Add -> Existing Item) directly in "App". I've been googling this for quite some time, but it seems that including projects in solutions in Visual Studio are common knowledge or something, and I'm the only one having problems.

Thanks in advance!
/JNT

Share this post


Link to post
Share on other sites
Advertisement
Alternatively, if they aren't a lot of files, you could add them directly to your game project as Linked Files. When you have the File Selection dialog open to add the file, the Add button has an arrow on it indicating a drop-down menu. Click the arrow and you will be presented with two options, "Add" and "Add as Link". Add as Link will keep the file in its original location but add it to your project as if it lived there in the project folder.

But you should probably be doing this at least as a static library, if not a DLL. The use case you've described here (being able to update the library in one place and move the changes out to others), is exactly what DLLs are for, because you may run in to situations where you can't make that copy work in particularly old projects.

Share this post


Link to post
Share on other sites

Alternatively, if they aren't a lot of files, you could add them directly to your game project as Linked Files. When you have the File Selection dialog open to add the file, the Add button has an arrow on it indicating a drop-down menu. Click the arrow and you will be presented with two options, "Add" and "Add as Link". Add as Link will keep the file in its original location but add it to your project as if it lived there in the project folder.

Essentially, this is the effect that I am looking for, although I would want to do it on a project basis, rather than on a file-by-file basis. It is strange though that I do not seem to be getting the option to add files as links. From the drop-down menu on Add I only have the options to "Add" and "Show previous versions". There is no "Add as link".


But you should probably be doing this at least as a static library, if not a DLL. The use case you've described here (being able to update the library in one place and move the changes out to others), is exactly what DLLs are for, because you may run in to situations where you can't make that copy work in particularly old projects.

I understand that the way I want to solve this problem might not be optimal down the road, but right now I really want to see if there is a solution to this problem. For instance, the Muli3D graphics engine includes a VC2005 project that, from what I can tell, includes projects and have them behave and depend on each other in the manner that I am looking for.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!