Skip to content

Commit 3737093

Browse files
committedApr 1, 2020
init commit
1 parent ccc3dcc commit 3737093

18 files changed

+569
-11
lines changed
 

‎EXE_LIB_DLL.sln

+20
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ VisualStudioVersion = 15.0.28307.1062
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyEXE", "MyEXE\MyEXE.vcxproj", "{9F940FEE-0625-42F9-A1ED-AB258C29A388}"
77
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyLIB", "MyLIB\MyLIB.vcxproj", "{DF63B638-1AC0-4D29-8268-A010A923CA81}"
9+
EndProject
10+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyDLL", "MyDLL\MyDLL.vcxproj", "{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}"
11+
EndProject
812
Global
913
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1014
Debug|x64 = Debug|x64
@@ -21,6 +25,22 @@ Global
2125
{9F940FEE-0625-42F9-A1ED-AB258C29A388}.Release|x64.Build.0 = Release|x64
2226
{9F940FEE-0625-42F9-A1ED-AB258C29A388}.Release|x86.ActiveCfg = Release|Win32
2327
{9F940FEE-0625-42F9-A1ED-AB258C29A388}.Release|x86.Build.0 = Release|Win32
28+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Debug|x64.ActiveCfg = Debug|x64
29+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Debug|x64.Build.0 = Debug|x64
30+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Debug|x86.ActiveCfg = Debug|Win32
31+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Debug|x86.Build.0 = Debug|Win32
32+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Release|x64.ActiveCfg = Release|x64
33+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Release|x64.Build.0 = Release|x64
34+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Release|x86.ActiveCfg = Release|Win32
35+
{DF63B638-1AC0-4D29-8268-A010A923CA81}.Release|x86.Build.0 = Release|Win32
36+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Debug|x64.ActiveCfg = Debug|x64
37+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Debug|x64.Build.0 = Debug|x64
38+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Debug|x86.ActiveCfg = Debug|Win32
39+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Debug|x86.Build.0 = Debug|Win32
40+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Release|x64.ActiveCfg = Release|x64
41+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Release|x64.Build.0 = Release|x64
42+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Release|x86.ActiveCfg = Release|Win32
43+
{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}.Release|x86.Build.0 = Release|Win32
2444
EndGlobalSection
2545
GlobalSection(SolutionProperties) = preSolution
2646
HideSolutionNode = FALSE

‎MyDLL/MyDLL.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// MyDLL.cpp : 定义 DLL 的导出函数。
2+
//
3+
4+
#include "pch.h"
5+
#include "framework.h"
6+
#include "MyDLL.h"
7+
8+
MYDLL_API void fnMyDLLWithDllExport(ostream & os) {
9+
os << "this is my dll with dllexport." << endl;
10+
}
11+
12+
MYDLL_API void fnMyDLLWithExternC(ostream & os){
13+
os << "this is my dll with extern C." << endl;
14+
}
15+
16+
void fnMyDLLWithDefFile(ostream & os) {
17+
os << "this is my dll with def file." << endl;
18+
}

‎MyDLL/MyDLL.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// 下列 ifdef 块是创建使从 DLL 导出更简单的
2+
// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 MYDLL_EXPORTS
3+
// 符号编译的。在使用此 DLL 的
4+
// 任何项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
5+
// MYDLL_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
6+
// 符号视为是被导出的。
7+
#ifdef MYDLL_EXPORTS
8+
#define MYDLL_API __declspec(dllexport)
9+
#else
10+
#define MYDLL_API __declspec(dllimport)
11+
#endif
12+
13+
#include <iostream>
14+
15+
using namespace std;
16+
17+
// 导出函数(使用dllexport)
18+
MYDLL_API void fnMyDLLWithDllExport(ostream &os);
19+
20+
// 导出函数(以C的方式声明)
21+
extern "C" {
22+
MYDLL_API void fnMyDLLWithExternC(ostream &os);
23+
}
24+
25+
// 导出函数(使用def文件)
26+
void fnMyDLLWithDefFile(ostream &os);

‎MyDLL/MyDLL.vcxproj

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{BDD5DF95-1EF6-4C6A-8E12-5B1CEAF44206}</ProjectGuid>
24+
<Keyword>Win32Proj</Keyword>
25+
<RootNamespace>MyDLL</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>DynamicLibrary</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v141</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>DynamicLibrary</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v141</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>DynamicLibrary</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v141</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>DynamicLibrary</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v141</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<TargetName>MYDLL</TargetName>
75+
<LinkIncremental>true</LinkIncremental>
76+
</PropertyGroup>
77+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
78+
<TargetName>MYDLL</TargetName>
79+
<LinkIncremental>true</LinkIncremental>
80+
</PropertyGroup>
81+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
82+
<TargetName>MYDLL</TargetName>
83+
<LinkIncremental>false</LinkIncremental>
84+
</PropertyGroup>
85+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
86+
<TargetName>MYDLL</TargetName>
87+
<LinkIncremental>false</LinkIncremental>
88+
</PropertyGroup>
89+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
90+
<ClCompile>
91+
<PrecompiledHeader>Use</PrecompiledHeader>
92+
<WarningLevel>Level3</WarningLevel>
93+
<Optimization>Disabled</Optimization>
94+
<SDLCheck>true</SDLCheck>
95+
<PreprocessorDefinitions>WIN32;_DEBUG;MYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
96+
<ConformanceMode>true</ConformanceMode>
97+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
98+
</ClCompile>
99+
<Link>
100+
<SubSystem>Windows</SubSystem>
101+
<GenerateDebugInformation>true</GenerateDebugInformation>
102+
<EnableUAC>false</EnableUAC>
103+
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
104+
</Link>
105+
</ItemDefinitionGroup>
106+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
107+
<ClCompile>
108+
<PrecompiledHeader>Use</PrecompiledHeader>
109+
<WarningLevel>Level3</WarningLevel>
110+
<Optimization>Disabled</Optimization>
111+
<SDLCheck>true</SDLCheck>
112+
<PreprocessorDefinitions>_DEBUG;MYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
113+
<ConformanceMode>true</ConformanceMode>
114+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
115+
</ClCompile>
116+
<Link>
117+
<SubSystem>Windows</SubSystem>
118+
<GenerateDebugInformation>true</GenerateDebugInformation>
119+
<EnableUAC>false</EnableUAC>
120+
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
121+
</Link>
122+
</ItemDefinitionGroup>
123+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
124+
<ClCompile>
125+
<PrecompiledHeader>Use</PrecompiledHeader>
126+
<WarningLevel>Level3</WarningLevel>
127+
<Optimization>MaxSpeed</Optimization>
128+
<FunctionLevelLinking>true</FunctionLevelLinking>
129+
<IntrinsicFunctions>true</IntrinsicFunctions>
130+
<SDLCheck>true</SDLCheck>
131+
<PreprocessorDefinitions>WIN32;NDEBUG;MYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
132+
<ConformanceMode>true</ConformanceMode>
133+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
134+
</ClCompile>
135+
<Link>
136+
<SubSystem>Windows</SubSystem>
137+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
138+
<OptimizeReferences>true</OptimizeReferences>
139+
<GenerateDebugInformation>true</GenerateDebugInformation>
140+
<EnableUAC>false</EnableUAC>
141+
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
142+
</Link>
143+
</ItemDefinitionGroup>
144+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
145+
<ClCompile>
146+
<PrecompiledHeader>Use</PrecompiledHeader>
147+
<WarningLevel>Level3</WarningLevel>
148+
<Optimization>MaxSpeed</Optimization>
149+
<FunctionLevelLinking>true</FunctionLevelLinking>
150+
<IntrinsicFunctions>true</IntrinsicFunctions>
151+
<SDLCheck>true</SDLCheck>
152+
<PreprocessorDefinitions>NDEBUG;MYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
153+
<ConformanceMode>true</ConformanceMode>
154+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
155+
</ClCompile>
156+
<Link>
157+
<SubSystem>Windows</SubSystem>
158+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
159+
<OptimizeReferences>true</OptimizeReferences>
160+
<GenerateDebugInformation>true</GenerateDebugInformation>
161+
<EnableUAC>false</EnableUAC>
162+
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
163+
</Link>
164+
</ItemDefinitionGroup>
165+
<ItemGroup>
166+
<None Include="cpp.hint" />
167+
<None Include="Source.def" />
168+
</ItemGroup>
169+
<ItemGroup>
170+
<ClInclude Include="framework.h" />
171+
<ClInclude Include="MyDLL.h" />
172+
<ClInclude Include="pch.h" />
173+
</ItemGroup>
174+
<ItemGroup>
175+
<ClCompile Include="dllmain.cpp" />
176+
<ClCompile Include="MyDLL.cpp" />
177+
<ClCompile Include="pch.cpp">
178+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
179+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
180+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
181+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
182+
</ClCompile>
183+
</ItemGroup>
184+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
185+
<ImportGroup Label="ExtensionTargets">
186+
</ImportGroup>
187+
</Project>

‎MyDLL/MyDLL.vcxproj.filters

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="源文件">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="头文件">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<None Include="cpp.hint" />
15+
<None Include="Source.def">
16+
<Filter>源文件</Filter>
17+
</None>
18+
</ItemGroup>
19+
<ItemGroup>
20+
<ClInclude Include="framework.h">
21+
<Filter>头文件</Filter>
22+
</ClInclude>
23+
<ClInclude Include="MyDLL.h">
24+
<Filter>头文件</Filter>
25+
</ClInclude>
26+
<ClInclude Include="pch.h">
27+
<Filter>头文件</Filter>
28+
</ClInclude>
29+
</ItemGroup>
30+
<ItemGroup>
31+
<ClCompile Include="MyDLL.cpp">
32+
<Filter>源文件</Filter>
33+
</ClCompile>
34+
<ClCompile Include="dllmain.cpp">
35+
<Filter>源文件</Filter>
36+
</ClCompile>
37+
<ClCompile Include="pch.cpp">
38+
<Filter>源文件</Filter>
39+
</ClCompile>
40+
</ItemGroup>
41+
</Project>

‎MyDLL/Source.def

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LIBRARY MyDLL
2+
EXPORTS
3+
fnMyDLLWithDefFile

‎MyDLL/cpp.hint

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define MYDLL_API __declspec(dllexport)
2+
#define MYDLL_API __declspec(dllimport)

‎MyDLL/dllmain.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// dllmain.cpp : 定义 DLL 应用程序的入口点。
2+
#include "pch.h"
3+
4+
BOOL APIENTRY DllMain( HMODULE hModule,
5+
DWORD ul_reason_for_call,
6+
LPVOID lpReserved
7+
)
8+
{
9+
switch (ul_reason_for_call)
10+
{
11+
case DLL_PROCESS_ATTACH:
12+
case DLL_THREAD_ATTACH:
13+
case DLL_THREAD_DETACH:
14+
case DLL_PROCESS_DETACH:
15+
break;
16+
}
17+
return TRUE;
18+
}
19+

‎MyDLL/framework.h

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
4+
// Windows 头文件
5+
#include <windows.h>

‎MyDLL/pch.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// pch.cpp: 与预编译标头对应的源文件
2+
3+
#include "pch.h"
4+
5+
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

‎MyDLL/pch.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// pch.h: 这是预编译标头文件。
2+
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
3+
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
4+
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
5+
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
6+
7+
#ifndef PCH_H
8+
#define PCH_H
9+
10+
// 添加要在此处预编译的标头
11+
#include "framework.h"
12+
13+
#endif //PCH_H

‎MyEXE/MyEXE.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22
//
33

44
#include <iostream>
5+
#include <MyLIB.h>
6+
#include <MyDLL.h>
57

6-
int main()
7-
{
8-
std::cout << "Hello World!\n";
8+
int main() {
9+
fnMyLIB(std::cout);
10+
11+
fnMyDLLWithDllExport(std::cout);
12+
fnMyDLLWithExternC(std::cout);
13+
fnMyDLLWithDefFile(std::cout);
14+
15+
std::cout << "this is my exe.\n";
16+
17+
system("PAUSE");
918
}
1019

1120
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单

‎MyEXE/MyEXE.vcxproj

+9
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,13 @@
9191
<SDLCheck>true</SDLCheck>
9292
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
9393
<ConformanceMode>true</ConformanceMode>
94+
<AdditionalIncludeDirectories>../MyLIB/;../MyDLL/</AdditionalIncludeDirectories>
9495
</ClCompile>
9596
<Link>
9697
<SubSystem>Console</SubSystem>
9798
<GenerateDebugInformation>true</GenerateDebugInformation>
99+
<AdditionalLibraryDirectories>../Debug/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
100+
<AdditionalDependencies>MyLIB.lib;MyDLL.lib;%(AdditionalDependencies)</AdditionalDependencies>
98101
</Link>
99102
</ItemDefinitionGroup>
100103
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -106,6 +109,8 @@
106109
<SDLCheck>true</SDLCheck>
107110
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
108111
<ConformanceMode>true</ConformanceMode>
112+
<AdditionalIncludeDirectories>
113+
</AdditionalIncludeDirectories>
109114
</ClCompile>
110115
<Link>
111116
<SubSystem>Console</SubSystem>
@@ -123,6 +128,8 @@
123128
<SDLCheck>true</SDLCheck>
124129
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
125130
<ConformanceMode>true</ConformanceMode>
131+
<AdditionalIncludeDirectories>
132+
</AdditionalIncludeDirectories>
126133
</ClCompile>
127134
<Link>
128135
<SubSystem>Console</SubSystem>
@@ -142,6 +149,8 @@
142149
<SDLCheck>true</SDLCheck>
143150
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
144151
<ConformanceMode>true</ConformanceMode>
152+
<AdditionalIncludeDirectories>
153+
</AdditionalIncludeDirectories>
145154
</ClCompile>
146155
<Link>
147156
<SubSystem>Console</SubSystem>

‎MyEXE/MyEXE.vcxproj.filters

+2-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
44
<Filter Include="源文件">
5-
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6-
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
5+
<UniqueIdentifier>{8ab0ebd8-01be-44e0-880a-b09c5cc64ee1}</UniqueIdentifier>
76
</Filter>
87
<Filter Include="头文件">
9-
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10-
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11-
</Filter>
12-
<Filter Include="资源文件">
13-
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14-
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
8+
<UniqueIdentifier>{be73ec18-38c7-4c05-a3ee-2d17620ae7f7}</UniqueIdentifier>
159
</Filter>
1610
</ItemGroup>
1711
<ItemGroup>

‎MyLIB/MyLIB.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// MyLIB.cpp : 定义静态库的函数。
2+
//
3+
4+
#include "MyLIB.h"
5+
6+
// TODO: 这是一个库函数示例
7+
void fnMyLIB(ostream &os) {
8+
os << "this is my lib.\n";
9+
}

‎MyLIB/MyLIB.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// @author liyan
3+
// @contact lyan_dut@outlook.com
4+
//
5+
6+
#include <iostream>
7+
8+
using namespace std;
9+
10+
void fnMyLIB(ostream &os);

‎MyLIB/MyLIB.vcxproj

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{DF63B638-1AC0-4D29-8268-A010A923CA81}</ProjectGuid>
24+
<Keyword>Win32Proj</Keyword>
25+
<RootNamespace>MyLIB</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>StaticLibrary</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v141</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>StaticLibrary</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v141</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>StaticLibrary</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v141</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>StaticLibrary</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v141</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<LinkIncremental>true</LinkIncremental>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
77+
<LinkIncremental>true</LinkIncremental>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
80+
<LinkIncremental>false</LinkIncremental>
81+
</PropertyGroup>
82+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
83+
<LinkIncremental>false</LinkIncremental>
84+
</PropertyGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86+
<ClCompile>
87+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
88+
<WarningLevel>Level3</WarningLevel>
89+
<Optimization>Disabled</Optimization>
90+
<SDLCheck>true</SDLCheck>
91+
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<ConformanceMode>true</ConformanceMode>
93+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
94+
</ClCompile>
95+
<Link>
96+
<SubSystem>Windows</SubSystem>
97+
<GenerateDebugInformation>true</GenerateDebugInformation>
98+
</Link>
99+
</ItemDefinitionGroup>
100+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
101+
<ClCompile>
102+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
103+
<WarningLevel>Level3</WarningLevel>
104+
<Optimization>Disabled</Optimization>
105+
<SDLCheck>true</SDLCheck>
106+
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107+
<ConformanceMode>true</ConformanceMode>
108+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
109+
</ClCompile>
110+
<Link>
111+
<SubSystem>Windows</SubSystem>
112+
<GenerateDebugInformation>true</GenerateDebugInformation>
113+
</Link>
114+
</ItemDefinitionGroup>
115+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
116+
<ClCompile>
117+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
118+
<WarningLevel>Level3</WarningLevel>
119+
<Optimization>MaxSpeed</Optimization>
120+
<FunctionLevelLinking>true</FunctionLevelLinking>
121+
<IntrinsicFunctions>true</IntrinsicFunctions>
122+
<SDLCheck>true</SDLCheck>
123+
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
124+
<ConformanceMode>true</ConformanceMode>
125+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
126+
</ClCompile>
127+
<Link>
128+
<SubSystem>Windows</SubSystem>
129+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
130+
<OptimizeReferences>true</OptimizeReferences>
131+
<GenerateDebugInformation>true</GenerateDebugInformation>
132+
</Link>
133+
</ItemDefinitionGroup>
134+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
135+
<ClCompile>
136+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
137+
<WarningLevel>Level3</WarningLevel>
138+
<Optimization>MaxSpeed</Optimization>
139+
<FunctionLevelLinking>true</FunctionLevelLinking>
140+
<IntrinsicFunctions>true</IntrinsicFunctions>
141+
<SDLCheck>true</SDLCheck>
142+
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
143+
<ConformanceMode>true</ConformanceMode>
144+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
145+
</ClCompile>
146+
<Link>
147+
<SubSystem>Windows</SubSystem>
148+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
149+
<OptimizeReferences>true</OptimizeReferences>
150+
<GenerateDebugInformation>true</GenerateDebugInformation>
151+
</Link>
152+
</ItemDefinitionGroup>
153+
<ItemGroup>
154+
<ClCompile Include="MyLIB.cpp" />
155+
</ItemGroup>
156+
<ItemGroup>
157+
<ClInclude Include="MyLIB.h">
158+
<SubType>
159+
</SubType>
160+
</ClInclude>
161+
</ItemGroup>
162+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
163+
<ImportGroup Label="ExtensionTargets">
164+
</ImportGroup>
165+
</Project>

‎MyLIB/MyLIB.vcxproj.filters

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="源文件">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="头文件">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClCompile Include="MyLIB.cpp">
15+
<Filter>源文件</Filter>
16+
</ClCompile>
17+
</ItemGroup>
18+
<ItemGroup>
19+
<ClInclude Include="MyLIB.h">
20+
<Filter>头文件</Filter>
21+
</ClInclude>
22+
</ItemGroup>
23+
</Project>

0 commit comments

Comments
 (0)
Please sign in to comment.