Jump to content
  • Advertisement
Josheir

C++ Visual Studio C++ Question

Recommended Posts

Posted (edited)

I have some important questions on the backburner but first I have a question of interest.  When using Visual Studio 2015 with C++  there are predefined environmental variables such as $SolutionDir  that are used for the build.  I have searched long and hard to no avail.  I am trying to modify these in a simple way.  I moved my file structure and although it did work relatively (which is great)  the build still mentions the old folders' names that were named before the change to the next project.

Thank you,

Josheir

Edit: If it helps they are also called macros.

Edited by Josheir

Share this post


Link to post
Share on other sites
Advertisement
Posted (edited)
15 hours ago, Josheir said:

When using Visual Studio 2015 with C++  there are predefined environmental variables such as $SolutionDir  that are used for the build.  I have searched long and hard to no avail.  I am trying to modify these in a simple way. 

I recommend that you avoid hacking VS projects and solutions; they are strongly intended to be managed automatically by Visual Studio.
If you have symptoms of corruption, such as obsolete directory names surviving a solution rename, you should probably reconstruct the solution and projects from scratch.

Can you explain the complications you are adding to normal project building? You shouldn't need to use special variables.

Edited by LorenzoGatti

Share this post


Link to post
Share on other sites
Posted (edited)
13 minutes ago, LorenzoGatti said:

I recommend to avoid hacking VS projects and solutions; they are strongly intended to be managed automatically by Visual Studio.
If you have symptoms of corruption, such as obsolete directory names surviving a solution rename, you should probably reconstruct the solution and projects from scratch.

Can you explain the complications you are adding to normal project building? You shouldn't need to use special variables.

 

Sure, it's something like this:

1>c:\latest\win32project10\win32project10\file.cpp(293)
1>  Win32Project10.vcxproj -> C:\latest hear it\Win32Project10\Debug\Project.exe
1>  Win32Project10.vcxproj -> C:\latest hear it\Win32Project10\Debug\Project.pdb (Full PDB)

Notice there are the unwanted:     Win32Project10

(six to be exact.)

 

It runs okay, I'm trying to make it pretty!    :)

 

Thank you,

Josheir

 

Edited by Josheir

Share this post


Link to post
Share on other sites

So you basically don't want the project folder inside the solution folder? That's a checkbox when creating a new solution with project.

You can manually copy the project folder to the solution folder level and then remove and re-add the project in Solution explorer. 
 

Note that you can have only one project cleanly in the solution folder then.

Share this post


Link to post
Share on other sites

Normally Visual Studio will use paths relative to the .sln file, which is represented with the $SolutionDir variable. That directory is generally the root of the project which can be moved freely to any path and is cloned to other machines through version control.

If you look in the project files typically the files are all relative to that directory. Sub-projects use the solution directory, and that means if you copy a sub-project into a new solution it will automatically use their values in the new solution file. Many tools use this to their advantage to allow per-solution configurations as they are used in many different applications.

Visual Studio's tools take steps to ensure the paths are relative, but it is still possible for you to use hard-coded paths or paths based on other elements, such as paths based on environment variables (e.g. environment variable of TOOL_SDK_PATH).

I'd look through your solution files, project files, property sheets, and similar configuration files to find any paths that are not relative.  Then use the IDE itself to remove those paths and re-add them, verifying that it is using a path relative to the solution directory. If for some reason the tools won't make it relative to the solution's root, I'd edit that by hand being careful to verify the tools still recognize the correct path.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!