Dev C++ 编译 Tiny XML 库文件

1. Dev C++ 使用 Tiny XML 时,报出 未定义的引用:

Dev C++ 编译 Tiny XML 库文件_第1张图片

对于这种问题,不用想都知道,缺少引用库文件(a文件) 。

2.Dev C++ 编译静态库文件:

2.1创建新工程:

Dev C++ 编译 Tiny XML 库文件_第2张图片 

2.2 把所有源码文件添加到工程中:

Dev C++ 编译 Tiny XML 库文件_第3张图片Dev C++ 编译 Tiny XML 库文件_第4张图片

 2.3 编译,即可在工程目录下找到库文件:

3. 再也不用担心我,Undefined reference to XXX了:

Rebuilding whole project...
--------
- Project Filename: D:\Programming\XmlParser\XmlParser.dev
- Compiler Name: TDM-GCC 4.9.2 32-bit Release

Building makefile...
--------
- Filename: D:\Programming\XmlParser\Makefile.win

Processing makefile...
--------
- Makefile Processor: C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\mingw32-make.exe
- Command: mingw32-make.exe -f "D:\Programming\XmlParser\Makefile.win" clean all

rm.exe -f parserMain.o XmlParser.exe

g++.exe -c parserMain.cpp -o parserMain.o -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -m32

g++.exe parserMain.o -o XmlParser.exe -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib32" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc ../TiXmlLib/tiXML.a -m32


Compilation results...
--------
- Errors: 0
- Warnings: 0
- Output Filename: D:\Programming\XmlParser\XmlParser.exe
- Output Size: 1.38776874542236 MiB
- Compilation Time: 1.94s

 

你可能感兴趣的:(XML解析,C++静态库,Dev,C++)