(windows sdk最干净配置)
VC++ 目录
可执行文件目录
E:\Microsoft Visual Studio 14.0\VC\bin; //cl.exe 编译器
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin //rc.exe编译器
包含目录
C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;
$(VC_IncludePath)
或
C:\Program Files\Windows Kits\10\Include\10.0.10240.0\ucrt
E:\Microsoft Visual Studio 14.0\VC\include
库目录
C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;
C:\Program Files\Windows Kits\10\lib\10.0.10240.0\ucrt\x86;
E:\Microsoft Visual Studio 14.0\VC\lib
c++
代码生成
运行库 多线程 (/MT)
链接器
输入
附加依赖库
%(AdditionalDependencies)
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
生成动态链接库
“属性面板” ”配置属性” ”常规”,配置类型选择动态库
h
#pragma once #define OS_API_IMPORT __declspec(dllimport) #define OS_API_EXPORT __declspec(dllexport) #ifdef BUILD_DLL //属性c++ 预处理器添加定义BUILD_DLL #define OS_API OS_API_EXPORT #else #define OS_API OS_API_IMPORT #endif class Zfang { public: OS_API Zfang(); OS_API ~Zfang(); OS_API void pf(); private: };
cpp
#include "Zfang.h" #include <iostream> using namespace std; Zfang::Zfang() { } Zfang::~Zfang() { } void Zfang::pf() { cout << "zfang!!!" << endl; }
使用动态链接库
包含目录
库目录
链接器
输入
附加依赖库(lib名)
原文:https://www.cnblogs.com/xiaomaoyvtou/p/14389047.html