CMarkup是一个很优秀的开源的解析XML工具,C++编写的,支持跨平台。源码也只有两个文件,一个.h和一个.cpp文件。
把这两个文件添加到工程中然后编译一下,出现以下错误:
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(24): fatal error C1189: #error: Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
然后回头看看它的头文件,在它的头文件中已经列举出了一些主要的编译开关:
// Major build options
// MARKUP_WCHAR wide char (2-byte UTF-16 on Windows, 4-byte UTF-32 on Linux and OS X)
// MARKUP_MBCS ANSI/double-byte strings on Windows
// MARKUP_STL (default except VC++) use STL strings instead of MFC strings
// MARKUP_SAFESTR to use string _s functions in VC++ 2005 (_MSC_VER >= 1400)
// MARKUP_WINCONV (default for VC++) for Windows API character conversion
// MARKUP_ICONV (default for GNU) for character conversion on Linux and OS X and other platforms
// MARKUP_STDCONV to use neither WINCONV or ICONV, falls back to setlocale based conversion for ANSI
//
我要是用STL的string,所以要添加宏开关 MARKUP_STL
这样编译就通过了!
aaa