windows生成动态库问题
- 对于大多数生成动态库dll的工程项目而言。要想生成xxx.lib 文件,可以通过将头文件添加
__dllexport
完成;如下
#define _WIN_EXPORT
#ifdef _WIN32
#ifdef _WIN_EXPORT
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#endif
DLL_EXPORT int yourfunctionAPi1();
DLL_EXPORT int yourfunctionAPi2();
VS修改代码,运行失效,未更新
- VS修改代码后,运行依然是修改之前的代码解决办法
- 菜单栏点击:工具=》选项=》项目和解决方案=》生成并运行=》运行期间,当项目过期时=》下拉菜单,选择始终生成,第2个下拉菜单选择提示启动。
VS Release模式下生成pdb文件
- step1: 项目->属性->C/C+±>General->Debug Information Format->Program Database for Edit & Continue (/ZI)
- step2: 项目->属性->C/C+±>Optimization->Optimization->Disabled(/Od)
- step3: 项目->属性->Linker->Debugging->Generate Debug Info->Yes(/DEBUG)