Common use C ++ html parsing library htmlcxx error Solution

htmlcxx is in C ++ parse html format of the data third-party libraries, but this stock in the following Bug, Bug will be given and solutions I encountered during use, please read my blog C ++ library html parsing tool of reptiles htmlcxx (attached VS2019 environment to build detailed process) , introduced htmlcxx local project build process, as well as environmental vs build process.

1 error, 17-line error util.cc file "constants have line breaks" when you compile the project htmlcxx

Solution: 17 util.cc the line of ""constant Delete, and then key again "".

The reason is that it contains an invisible line breaks in the 0.86 version.
Here Insert Picture Description

2 error, Development projects using errorLNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MTd_StaticDebug”不匹配值“MDd_DynamicDebug”(HttpUtils.obj 中) 京东方在线爬虫 E:\Projects\Vistual Studio Projects\京东方在线爬虫\htmlcxx.lib(Node.obj) 1

Here Insert Picture Description
This is because the local compile htmlcxxway to use the default runtime project is 多线程调试 (/MTd), in vs the project default runtime mode used多线程调试 DLL (/MDd)

Solution: The htmlcxxproject was compiled before the amendment 多线程调试 DLL (/MDd), and then compile or runtime to modify the use of htmlcxx way 多线程调试 (/MTd), will Two Person Commission One which is can \ Color {red} to unify the two .

Modify the method runtime mode project:
Here Insert Picture Description
Here Insert Picture Description
Modify its properties -> Configuration Properties -> C / C + ±> Code Generation -> Runtime
Here Insert Picture Description
Here Insert Picture Description

Error 3: Resolve htmlwhen error will complainExpression:c>=-1&&c<=255

Here Insert Picture Description
The reason is that the Chinese html occurred, there is a code value determination method will be the ASCII character, in which case the Chinese operation range, an error is reported.

Solution: Add code before parsing htmlsetlocale(LC_ALL, ".OCP");

Here Insert Picture Description
More than three error solution I have been met, that much is tears. . .

Hope you can help to addicts, these Bug may have been tossing a few hours to see this blog enlightened, not a point to praise too dung Ha ~Here Insert Picture Description

Published 979 original articles · won praise 243 · views 210 000 +

Guess you like

Origin blog.csdn.net/qq_41855420/article/details/104563823