单个项目解决方案
解决方案是为项目添加 /FS (Force Synchronous PDB Writes) 编译选项,具体位置在:
一劳永逸的解决方案
直接修改cocos的项目模板templatescpp-template-defaultproj.win32HelloCpp.vcxproj为:
- <?xml version="1.0" encoding="utf-8"?>
- <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{76A39BB2-9B84-4C65-98A5-654D86B86F2A}</ProjectGuid>
- <RootNamespace>test_win32</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)Microsoft SDKsWindowsv7.1A')">v110_xp</PlatformToolset>
- <PlatformToolset>v120</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)Microsoft SDKsWindowsv7.1A')">v110_xp</PlatformToolset>
- <PlatformToolset>v120</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..cocos2dcocos2dcocos2dx.props" />
- <Import Project="..cocos2dcocos2dcocos2d_headers.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..cocos2dcocos2dcocos2dx.props" />
- <Import Project="..cocos2dcocos2dcocos2d_headers.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration).win32</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration).win32</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration).win32</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration).win32</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LibraryPath>$(MSBuildProgramFiles32)Microsoft SDKsWindowsv7.1Alib;$(LibraryPath)</LibraryPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LibraryPath>$(MSBuildProgramFiles32)Microsoft SDKsWindowsv7.1Alib;$(LibraryPath)</LibraryPath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(EngineRoot)cocosaudioinclude;$(EngineRoot)external;$(EngineRoot)externalchipmunkincludechipmunk;$(EngineRoot)extensions;..Classes;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>false</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
- <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>
- </Command>
- </PostBuildEvent>
- <PreLinkEvent>
- <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
- xcopy /Y /Q "$(EngineRoot)externalwebsocketsprebuiltwin32*.*" "$(OutDir)"</Command>
- </PreLinkEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>$(EngineRoot)cocosaudioinclude;$(EngineRoot)external;$(EngineRoot)externalchipmunkincludechipmunk;$(EngineRoot)extensions;..Classes;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- </ClCompile>
- <Link>
- <AdditionalDependencies>libcurl_imp.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
- <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>
- </Command>
- </PostBuildEvent>
- <PreLinkEvent>
- <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
- xcopy /Y /Q "$(EngineRoot)externalwebsocketsprebuiltwin32*.*" "$(OutDir)"</Command>
- </PreLinkEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..ClassesAppDelegate.cpp" />
- <ClCompile Include="..ClassesHelloWorldScene.cpp" />
- <ClCompile Include="main.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..ClassesAppDelegate.h" />
- <ClInclude Include="..ClassesHelloWorldScene.h" />
- <ClInclude Include="main.h" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..cocos2dcocos2dcocos2d.vcxproj">
- <Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..cocos2dcocosaudioproj.win32CocosDenshion.vcxproj">
- <Project>{f8edd7fa-9a51-4e80-baeb-860825d2eac6}</Project>
- </ProjectReference>
- <ProjectReference Include="..cocos2dexternalchipmunkproj.win32chipmunk.vcxproj">
- <Project>{207bc7a9-ccf1-4f2f-a04d-45f72242ae25}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="game.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
- </Project>
这样不仅解决了这个问题,还能避免每次开新项目时的强制升级。