The default Visual Studio setup is impractical. Here is my setup for C++:
- Treat 4013 warning (... undefined; assuming extern returning int) as error
- To have the folder structure in disk in Solution Explorer, use "Show All Files" view:
- 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