在 Windows 上使用 MinGW 编译 Poco [英] Compile Poco with MinGW on Windows
问题描述
我需要用 MinGW 编译 poco,所以我可以在 Qt Creator 中使用它,但不知道如何使用,我已经设法在 Visual Studio 中编译了 poco,但我无法在 Qt Creator 中使用这些库.
I need to compile poco with MinGW so I can use it in Qt Creator but cannot figure out how to, I've managed to compile poco in Visual Studio but I cannot use those libraries in Qt Creator.
推荐答案
补充 Cesar 的答案(此处,为了格式化目的,而不是添加评论),您的 .pro 文件中需要这样的内容:
Complementing Cesar's answer (here, instead of adding a comment, for formatting purposes), you need something like this on your .pro file:
INCLUDEPATH += "<path_to_poco_include_dir>"
LIBS += -L"<path_to_poco_lib_dir>" -l<poco_lib> -l<poco_lib>
例如,就我而言,我会有这个(用于调试版本):
E.g., in my case, I would have this (for debug builds):
INCLUDEPATH += "C:/Dev/lib/poco/poco143/Debug/include"
LIBS += -L"C:/Dev/lib/poco/poco143/lib" -lPocoFoundationd -lPocoUtild
然后您可以通过为调试和发布版本创建设置来对此进行一些改进:
You can then refine this a bit, by creating settings for both debug and release builds:
LIB_HOME = "C:/Dev/lib/"
POCO_HOME = $${LIB_HOME}poco/poco143/
# SEE http://www.qtcentre.org/threads/23655-Does-Qt-Creator-understand-debug-release-scopes-in-pro-files
# OR http://www.qtcentre.org/threads/30430-How-to-set-pro-file-about-debug-and-release
####
CONFIG(debug, debug|release) {
CONFIG -= debug release
CONFIG += debug
}
CONFIG(release, debug|release) {
CONFIG -= debug release
CONFIG += release
}
####
debug {
POCO_DEBUG = d
POCO_PATH = $${POCO_HOME}Debug
}
release {
POCO_DEBUG =
POCO_PATH = $${POCO_HOME}Release
}
INCLUDEPATH += "$${POCO_PATH}/include"
LIBS += -L"$${POCO_PATH}/lib" -lPocoFoundation$${POCO_DEBUG} -lPocoUtil$${POCO_DEBUG}
希望这会有所帮助.
这篇关于在 Windows 上使用 MinGW 编译 Poco的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!