[英]How to configure Qt Creator to use Boost in Windows
I created a Qt project in Ubuntu and everything went smoothly. 我在Ubuntu中创建了一个Qt项目,一切顺利。 However, I also need deploy it on Windows.
但是,我还需要在Windows上部署它。 It uses Boost libraries(the big problem).
它使用Boost库(最大的问题)。
I've been searching for hours to find a solution, but didn't have luck. 我一直在寻找解决方案的几个小时,但没有运气。 I tried to install Boost libraries and link it with mingw;
我试图安装Boost库并将其与mingw链接; I think I missed something.
我想我错过了什么。 Here is what I did and downloading the lastest version:
这是我做的和下载最新版本:
1) ran .\\bootstrap 1)跑。\\ bootstrap
2) then .\\b2 --prefix=C:\\boost install 2)然后。\\ b2 --prefix = C:\\ boost install
Sadly didn't install correctly. 可悲的是没有正确安装。 I got only 2 folder(bin and share) but no headers.
我只有2个文件夹(bin和共享)但没有标题。
However, here ( http://nuwen.net/ ) I found a bundle(Mingw+Boost and other libraries). 但是,在这里( http://nuwen.net/ )我找到了一个包(Mingw + Boost和其他库)。 This has everything I need.
这有我需要的一切。
Now I think the issue is .pro file, because I have a lot of undefined references. 现在我认为问题是.pro文件,因为我有很多未定义的引用。 Here is .pro file with everything I tried (some commented): http://pastebin.com/pBFMTAd8
这是.pro文件,包含我尝试的所有内容(一些评论): http : //pastebin.com/pBFMTAd8
Your help is appreciated! 非常感谢您的帮助!
I did solve the problem myself. 我自己确实解决了这个问题。 And here is how I did it.
以下是我的表现方式。 First of all, it is required to have boost library compiled with same compiler you're using with Qt.
首先,需要使用与Qt一起使用的相同编译器编译的boost库。
If you're using msvc, then you're lucky because Boost guys did you a favour and compiled libraries for you. 如果你正在使用msvc,那么你很幸运,因为Boost的人帮你一个忙,并为你编译了库。 You can download them here: http://sourceforge.net/projects/boost/files/boost-binaries/ .
您可以在此处下载: http : //sourceforge.net/projects/boost/files/boost-binaries/ 。
If you're using mingw (which does come in bundle with Qt), you can do this: 如果您正在使用mingw(它与Qt捆绑在一起),您可以这样做:
Hope this works for you too! 希望这也适合你!
Update : The folder hierarchy has change. 更新 :文件夹层次结构已更改。 For building the library, one should read the documentation associated with each version and Boost.Build's documentation .
要构建库,应该阅读与每个版本相关的文档和Boost.Build的文档 。 Building the library from the root folder is easier ( Building Boost 1.52 with MinGW ):
从根文件夹构建库更容易( 使用MinGW构建Boost 1.52 ):
C:\boost_1_60_0> bootstrap.bat mingw
C:\boost_1_60_0> .\b2 --toolset=gcc -j N --build-type=complete
building boost will not put the headers, the headers are for the developer when he creates new code. 构建boost不会放置标题,标题是为开发人员创建新代码时。 The installed dirs are the binaries for distribution.
已安装的目录是用于分发的二进制文件。
see http://www.boost.org/doc/libs/1_54_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary 见http://www.boost.org/doc/libs/1_54_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary
this will install libraries, that you use at runtime (not compile time). 这将安装您在运行时使用的库(不是编译时)。 Because you add this bin folder to your path and that is why when runing an app build with boost it will run and not say "could not find xxx.dll"
因为你将这个bin文件夹添加到你的路径,这就是为什么当使用boost运行应用程序构建时它会运行而不是说“找不到xxx.dll”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.