So you have changed your $(OutDir)
variables in your project file and it is producing a bad path. Please go to your project's properties for the configuration/platform you're building. Then post the contents of the aforementioned variables along with the various $(Target...)
variables. It sounds like you might have probably missed a slash and so it isn't building paths properly. Note that there are Path
and Dir
properties and they must be properly built.
VS 2017 compiles but not creating executable in release mode.

Hello,
I am building and compiling a C++ application using VS 2017. In debug mode it builds , compile and create an executable. Although in release mode, the build process finish successfully, it does not create an executable. Here is the log:
The last lines of the log are:
5>Generating Code...
5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1216,5): warning MSB8012:
TargetPath(F:\cavewriting_ike\build\windows\cwapp\Release\CWApp.exe) does not match the Linker's OutputFile property value (F:\cavewriting_ike\bin\win32\CW.exe). This
may
cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1218,5): warning MSB8012: TargetName(CWApp) does not match the Linker's OutputFile property value (CW). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
5>CWApp.vcxproj -> F:\cavewriting_ike\build\windows\cwapp\Release\CWApp.exe
5>Done building project "CWApp.vcxproj".
But if I go to the mentioned path, there is not CWApp.exe file.
Here are the project configuration settings:
Any ideas what I am missing?
Thanks
-
Michael Taylor 41,191 Reputation points
2022-01-31T15:42:26.613+00:00
That screenshot isn't really showing all the output/target values we need. Go to
Tools \ Options
->Projects and Solutions \ Build and Run
. At the bottom are options for MSBuild build outputs and log files. Set them toDiagnostics
and build your project. Then post the build file. It'll have all the parameters and command lines that will reveal where everything is going.I rebuilt the project and got these files. I noticed in the cwappbuildcppclean.log there is a f:\cavewriting_ike\bin\win32\cw.exe file. Is that the one? if so, why the debug configuration does create an executable in the output project set in the target configuration?
169982-cwapp.log
169918-cwappbuildcppclean.log
The MSBuild paths seem reasonable but I'm still looking. However I notice that your CWApp has a custom build step in the logs. Take a look at your Debug configuration and see if it is doing something custom with the output. Then look at your release configuration. Note that most things in projects are configuration specific but pre/post-build events are shared.
I can see that your exe's path is different than the PDB and intermediate files so it looks like a configuration change somewhere in the build process. Can you possibly post the
cwapp.vcxproj
file so we can see any customizations made to the project.Here's the file you asked. Sorry about the delay.
Also, I didnt see any differences in the pre/post events. Many of the main differences are in the runtime build options (optimization disable/O2 . CRT )
I appreciate the help.
170041-cwappvcxproj.txt
Not sure why, but for the Release\Win32 build your Linker\General -> Output File setting is set to
$(BinPath)/cw.exe
which is why it is going there. For your Debug configuration it is$(OutDir)$(TargetName)$(TargetExt)
. Change that value back to the default value and you should get the same behavior for release builds as debug builds.That made the trick !!
Thank you very much for your help.
Sign in to comment
0 additional answers
Sort by: Most helpful