Masm32中 kernel32.inc 中对GetEnvironmentStrings存在问题 所以当在私用masm编译的时候会出现如下错误提示 LIBCD.lib(a_env.obj) : error LNK2001: unresolved external symbol __imp__GetEnvironmentStrings@0 test.exe : fatal error LNK1120: 1 unresolved externals
windows api中大部分api都有两个版本 A 版本和W版本 例如 #ifdef UNICODE #define MessageBox MessageBoxW #else #define MessageBox MessageBoxA #endif // !UNICODE GetEnvironmentStrings也存在两个版本 #ifdef UNICODE #define GetEnvironmentStrings GetEnvironmentStringsW #else #define GetEnvironmentStrings GetEnvironmentStrings #endif // !UNICODE 但是不知由于什么原因 可能weiruan疏忽所以 GetEnvironmentStrings的ANSI版本是 GetEnvironmentStrings而不是GetEnvironmentStringsA 但是masm却将其当做GetEnvironmentStringsA来处理的 见masm中对其宏定义 GetEnvironmentStringsA PROTO GetEnvironmentStrings equ <GetEnvironmentStringsA> 所以再使用GetEnvironmentStrings宏的时候找不到GetEnvironmentStrings去替换而是找了GetEnvironmentStringsA 然而GetEnvironmentStringsA是不存在的 所以出现了上述问题 |
解决方案将masm32中的kernel32.inc中的 GetEnvironmentStringsA PROTO GetEnvironmentStrings equ <GetEnvironmentStringsA> 替换成 GetEnvironmentStrings PROTO 然后使用inc2l.exe工具 E:/Program Files/RadASM/masm32/include>inc2l kernel32.inc命令 将生成的kernel32.lib替换masm32中kernel32.lib OK 问题解决 |