Tuesday, January 4, 2022

Visual Studio Setup

The default Visual Studio setup is impractical. Here is my setup for C++:

  • Output Directory: $(SolutionDir)bin\$(Platform)\$(Configuration)\
  • Intermediate Directory: $(SolutionDir)bin\intermediate\$(Platform)\$(Configuration)\
  • To read files from exe folder instead of solution folder when running from IDE, Working Directory: $(SolutionDir)bin\$(Platform)\$(Configuration)\

  • I put a sample VS2022 project template to github.
  • To copy an input file (file.txt) to exe folder after a build: xcopy $(SolutionDir)file.txt $(SolutionDir)bin\$(Platform)\$(Configuration)\ /Y

Note: If you use the same intermediate folder for all configurations, you might get "fatal error C1041: cannot open program database ...vc120.pdb". The solution is to set /FS command line flag.

No comments:

Post a Comment