提振Netbeans的7.1.1 [英] Boost in Netbeans 7.1.1
问题描述
试图运行以下命令:
#include<iostream>
#include<boost/filesystem/operations.hpp>
namespace bfs=boost::filesystem;
int main()
{
bfs::path p("second.cpp");
if(bfs::exists(p))
std::cout<<p.leaf()<<std::endl;
}
我在Cygwin的一些错误,所以我决定尝试NetBeans和使用的<一个href=\"http://stackoverflow.com/questions/13291582/netbeans-ide-7-2-1-how-to-add-the-c-boost-library\">following作为指导。我添加了所有环节,以下为文件系统项目 - &GT;性能 - &GT;链接 - &GT;库 - &GT;添加选项 - &GT;其他 - &GT; -lfile_system
如上所述的此处。我已经运行使用一个单独的测试#包括LT&;升压/ any.hpp方式&gt;
所以我不怀疑目前,我的提升没有安装correclty
I got some errors in cygwin so I decided to try out netbeans, and used the following as a guide. I added all links and the following for filesystem Project -> properties -> Linker ->Libraries -> Add option -> Other -> -lfile_system
as noted here. I have run a separate test using #include<boost/any.hpp>
so I am not currently doubting that my boost is not installed correclty.
这似乎不可思议,我认为它是file_system的,所以我也试过文件系统,但无济于事。
It seems weird to me that it is "file_system", so I also tried "filesystem" but to no avail.
当我按住控制
,然后点击#包括&LT;升压/文件系统/ operations.hpp&GT;
我的netbeans带来我的 operations.hpp
文件看起来是这样的好(与正常内部,它可以看到我想要它,看看)。
When i hold Ctrl
and click on #include<boost/filesystem/operations.hpp>
my netbeans brings up my operations.hpp
file so it seems okay (linked properly internally that it can "see" what I want it to see).
要安装升压解决方案排在下面的表格:
1 - 如果你正在使用Visual Studio的任何路径变量,你应该暂时在安装过程中更改变量。 这是一个很好的指南。一旦做到这一点,这是一步完成。
The solution to installing boost came in the following form: 1 - If you have any path variables that are being used for Visual Studio you should temporarily change the variable during installation. This is a good guide. Once that is done, this is one step completed.
2 - 下载并安装MinGW的。这是一个非常简单的过程,你可以找到安装程序文件这里。
2 - Download and install MinGW. This is a very easy process and you can find the installer files here.
一旦你做这些事情(如果你在同样的情况我),你现在就可以正常安装的推动作用。
Once you have done these things (if you are in the same situation as me), you will now be able to properly install boost.
Horay!
推荐答案
创建新项目
的这是更好地采取在本教程中的这里给出的确切名称即可。后来问:它不工作,则可以更容易找到的
It is better to take the names given here in this tutorial exactly. Later ask: It does not work, can then be easier to find.
我不认为我需要提到的所有 T:\\
当然必须与你的驱动器替换
I do not think I need to mention all T:\
must of course be replaced with your drive.
项目名称:升压CYG-测试
现在您的项目应该看起来像
Now your Project should look like
开放的main.cpp结果
覆盖生成的code有以下几点。我们想,首先一切工作没有错误。
Open main.cpp
Overwrite the generated code with the following. We want to that, first of all everything works without error.
因此,请不要用你自己的特殊code。结果
它是很难找到故障。然后告诉几经询问,得到:结果
的我用我自己的code 的
Therefore, please do not use your own special code.
It is difficult to find a fault. Then told after several ask, to get:
I have used my own code
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
int main()
{
path p("second.cpp");
if (exists(p)) { std::cout<<p.leaf()<<std::endl; }
}
的在本节中,我们假设助推已经编制。的
转到工具 - >选项
您C ++ code帮助选项应该是这个样子。
Your C++ Code Assistance options should look something like this.
如果不是这样,我们应该让Netbeans的创建,对于我们的。
If this is not so, we should let Netbeans create that for us.
添加新工具集合
后,我们已经完成了这个对话框,OK,我们应该找到如上图所示的设置。 (C ++ code帮助选项)。
After we have completed this dialog with OK, we should find the settings shown above. ( C++ Code Assistance options).
所有库复制到正确的位置
让我们创建一个新的文件夹提升。
Let's create a new folder 'boost'.
通过一个搜索工具,在你的编译升压文件夹搜索 *一个
结果
我的加速
编译与共享选项
所以我们发现:
With a search tool, search in your compiled Boost folder for *.a
My Boost
is compiled with the shared option
so we find :
有关我们短暂的应用。我们只需要2个文件。
For our short App. we need only 2 files.
libboost_filesystem-gcc45-mt-d-1_53.dll.a
libboost_system-gcc45-mt-d-1_53.dll.a
但是,如果我们是在它拷贝两个文件,我们可以复制所有文件。结果
所以标记所有找到 .A
文件并将其复制到该目录刚创建的结果 T:\\ Cygwin的\\ lib目录\\提振
But if we're at it to copy two files, we can copy all files.
So mark all found .a
files and copy them into the directory just created
T:\cygwin\lib\boost
.
现在我们做同样与我们的的.dll
文件。结果
标记所有的.dll
文件,并复制它在你的:\\ cygwin的\\斌
目录结果
如果你只编译静态图书馆的,你可以跳过这一点。
Now we do the same with our .dll
files.
Mark all .dll
files and copy it in your ?:\cygwin\bin
directory.
If you only have compiled static librarys, you can skip this point.
现在是时候改变我们的项目设置。结果
正如你所看到的,我把我的源文件夹加速进入cygwin的
Now it's time to modify our project settings.
As you can see i put my source Boost folder into cygwin
和
正如我们已经如上所述,我们需要两个 .A
文件。结果
用添加库导航到 T:\\ Cygwin的\\ lib目录\\提振
并选择
As we have already noted above, we need two .a
files.
with Add Library navigate to T:\cygwin\lib\boost
and select
libboost_filesystem-gcc45-mt-d-1_53.dll.a
libboost_system-gcc45-mt-d-1_53.dll.a
现在你会发现,这个名称是由NetBeans的缩短为:
Now you'll notice that this name was shortened by netbeans to:
boost_filesystem-gcc45-mt-d-1_53.dll
boost_system-gcc45-mt-d-1_53.dll
这是有点混乱。看起来好像一个的.dll
是站在这里。但它确实是一个 .A
文件。
This is somewhat confusing. It looks as if a .dll
is standing here. But it is really a .a
file.
坐落在main.cpp中断点。现在我们开始调试。
Set a breakpoint in main.cpp. Now we start debug.
我已标记的重要组成部分,这两个库,有一个箭头。结果
所有的库被发现,并完成后,在断点处停止。
I have marked the important part, the two libs, with an arrow.
All libs are found and after make has finished, stops at the breakpoint.
输出:
对于所有谁想要建立共享库本身的推动作用。
For all who want to create boost with shared library itself.
创建您的文件夹:\\ cygwin目录结果。 boost_1_53_0
Create a folder in your ?:\cygwin directory.
boost_1_53_0
把zip文件解压到该目录中。结果
它应该看起来像:
Extract the zip file into that directory.
It should look like:
打开一个cmd窗口,cd到 boost_1_53_0
目录。结果
为了有一个干净的构建,我们需要有只有 cygwin的家
和斌
的路径。结果
在cmd类型。
open a cmd window, cd to boost_1_53_0
directory.
To have a clean build we need a PATH that have only the cygwin home
and bin
.
In the cmd type.
SET PATH=T:\cygwin;T:\cygwin\bin
和测试的路径。
PATH
键入
bootstrap.bat
键入
.\b2 --build-dir=T:\boost-cyg toolset=gcc variant=debug link=shared runtime-link=shared
在一段时间内构建完成。结果
现在你有我们在教程中所使用的相同环境。
After some time the build is finished.
Now you have the same environment that we have used in the tutorial.
如果你得到一个错误: GCC没有找到
结果
在副本(不重命名):\\ cygwin的\\斌
文件夹,例如:(名称可能不同)结果。的i686-PC-cygwin的-GCC-4.5.3.exe
到 gcc.exe
结果
和结果的i686-PC-cygwin的-G ++ - 4.exe
到 G ++ exe文件
If you get a Error : gcc not found
copy (not rename) in ?:\cygwin\bin
folder, for example : (names may differ).
i686-pc-cygwin-gcc-4.5.3.exe
to gcc.exe
and
i686-pc-cygwin-g++-4.exe
to g++.exe
希望它可以帮助你。
这篇关于提振Netbeans的7.1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!