我需要编译lame_enc.dll的旧版本(MP3编码器,版本3.97)。
向Visual Studio 2019的单向迁移报告说,可能需要更改代码才能正确创建项目。尝试编译DLL时,有几个警告和以下错误。
C1189 #error: Macro definition of snprintf conflicts with Standard Library function declaration libmp3lame C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h 1935
LNK1181 Cannot open Input file "C:\Users\*\Desktop\lame-3.97\libmp3lame\Debug\libmp3lame.lib". LameMp3EncDll C:\Users\*\OneDrive\Desktop\lame-3.97\Dll\LINK 1
[MSBuild和Devenv自2019年,2015年和2010年以来均导致相同的错误。
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1935,1): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration [C:\Users\*\Desktop\lame-3.97\libmp3lame\libmp3lame_vc7.vcxproj]
This是我正在使用的确切版本和文件。
我需要使用/执行哪些操作来编译dll?
我需要使用/执行哪些操作来编译dll?
Visual Studio 14+在snprintf
中将_snprintf
定义为stdio.h
。
解决方案>>
[1)
以管理员身份运行VS2019,然后重新打开您的项目[2)
将#define snprintf _snprintf
文件中的stdio.h
更改为#if _MSC_VER < 1900 # define snprintf _snprintf #endif
** 3)**编辑->查找和替换->在文件中查找->
查找内容
:#\s*define\s+snprintf
查找
:整个解决方案(包括外部项目)选择Match case
和Use Regular Expressions
因此,请将#define snprintf _snprintf
更改为:
:在#if _MSC_VER < 1900 # define snprintf _snprintf #endif
注意
id3tag.c
文件中更改它们>更改
#ifdef _MSC_VER #define snprintf _snprintf #endif
至:
#if _MSC_VER < 1900 # define snprintf _snprintf #endif