xpdf编译的第四个错误

原本以为解决了freetype2.lib的问题后就会成功了,结果:

cl /MT /nologo /Fepdftoppm.exe Annot.obj Array.obj BuiltinFont.obj BuiltinFontTables.obj Catalog.obj CharCodeToUnicode.obj CMap.obj Decrypt.obj Dict.obj Error.obj FontEncodingTables.obj Function.obj Gfx.obj GfxFont.bj GfxState.obj GlobalParams.obj JArithmeticDecoder.obj JBIG2Stream.obj JPXStream.obj Lexer.obj Link.obj NameToCharCode.obj Object.obj Outline.obj OutputDev.obj Page.obj Parser.obj PDFDoc.obj PDFDocEncoding.obj PSTokenizer.obj SecurityHandler.obj SplashOutputDev.obj Stream.obj UnicodeMap.obj UnicodeTypeTable.obj XRef.obj pdftoppm.obj ..\splash\splash.lib ..\fofi\fofi.lib ..\goo\Goo.lib ..\freetype-2.3.1\freetype2.lib shell32.lib user32.lib gdi32.lib advapi32.lib
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _strncpy 已在 LIBCMT.lib(strncpy.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _strrchr 已在 LIBCMT.lib(strrchr.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove 已在 LIBCMT.lib(memmove.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc 已在 LIBCMT.lib(malloc.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc 已在 LIBCMT.lib(realloc.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free 已在 LIBCMT.lib(free.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fclose 已在 LIBCMT.lib(fclose.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fread 已在 LIBCMT.lib(fread.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fseek 已在 LIBCMT.lib(fseek.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _ftell 已在 LIBCMT.lib(ftell.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fopen 已在 LIBCMT.lib(fopen.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _qsort 已在 LIBCMT.lib(qsort.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sprintf 已在 LIBCMT.lib(sprintf.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _strncmp 已在 LIBCMT.lib(strncmp.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isdigit 已在 LIBCMT.lib(_ctype.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _atol 已在 LIBCMT.lib(atox.obj) 中定义过了
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isxdigit 已在 LIBCMT.lib(_ctype.obj) 中定义过了
MSVCRT.lib(ti_inst.obj) : error LNK2005: “private: __thiscall type_info::type_info(class type_info const &)” (??0type_info@@AAE@ABV0@@Z) 已在 LIBCMT.lib(typinfo.obj) 中定义过了
MSVCRT.lib(ti_inst.obj) : error LNK2005: “private: class type_info & __thiscall type_info::operator=(class type_info const &)” (??4type_info@@AAEAAV0@ABV0@@Z) 已在 LIBCMT.lib(typinfo.obj) 中定义过了
LINK : warning LNK4098: 预设的程式库 ‘MSVCRT’ 与其他使用的程式库冲突,请使用 /NODEFAULTLIB:library
pdftoppm.exe : fatal error LNK1169: 找到有一或多个已定义的符号

后来Google到Linker Tools Warning LNK4098
defaultlib “library” conflicts with use of other libs; use /NODEFAULTLIB:library

这一篇的这个表格:

The table below shows which libraries should be ignored depending on which run-time library you want to use.
To use this run-time library
Ignore these libraries
Single-threaded (libc.lib)
libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded (libcmt.lib)
libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded using DLL (msvcrt.lib)
libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Debug Single-threaded (libcd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcmtd.lib, msvcrtd.lib
Debug Multithreaded (libcmtd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib
Debug Multithreaded using DLL (msvcrtd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib

原创 关于LNK4098MSDN中的一些说明收藏

Linker Tools Warning LNK4098
defaultlib “library” conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
Important The run-time libraries now contain directives to prevent mixing different types. You’ll receive this warning if you try to use different types or debug and non-debug versions of the run-time library in the same program. For example, if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you’ll get this warning. You should compile all source files to use the same run-time library. See the Use Run-Time Library (MD, /ML, /MT, /LD) compiler options for more information.
You can use the linker’s /VERBOSE:LIB switch to determine which libraries the linker is searching. If you receive LNK4098 and want to create an executable file that uses, for example, the single-threaded, non-debug run-time libraries, use the /VERBOSE:LIB option to find out which libraries the linker is searching. The linker should print LIBC.LIB and not LIBCMT.LIB, MSVCRT.LIB, LIBCD.LIB, LIBCMTD.LIB, or MSVCRTD.LIB as the libraries searched. You can tell the linker to ignore the the incorrect run-time libraries by typing the incorrect libraries in the Ignore Libraries text box on the Link tab of the Settings dialog box in Developer’s Studio or by using the /NODEFAULTLIB:library option with LINK for each library you want to ignore. See the Ignore Libraries (/NODEFAULTLIB) linker option for more information.
The table below shows which libraries should be ignored depending on which run-time library you want to use.
To use this run-time library
Ignore these libraries
Single-threaded (libc.lib)
libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded (libcmt.lib)
libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded using DLL (msvcrt.lib)
libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Debug Single-threaded (libcd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcmtd.lib, msvcrtd.lib
Debug Multithreaded (libcmtd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib
Debug Multithreaded using DLL (msvcrtd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib

引起我的注意,我猜我在建置时可能选错了方案组态,所以我将Release改成Release Multithreaded重新建置后,再重新编译xpdf可真的成功了!!没有错误接下来就试试看能不能使用了!