Newbie needs help with VC6 & filesystem library
Greetings,
Though I'm an "old hand" at C++, I'm a complete newbie when it comes
to Boost. The piece that really caught my eye, in light of my current
project, is the directory iterator. To date, however, I haven't had
any success getting it to compile and function under Win32 with MSVC6,
so I thought I would post here. I first have a couple of general
questions about using Boost, and then one specific question about the
problems with my project at hand.
(1) Is there a "right" way to include Boost stuff with VC6? Adding the
Boost base directory to my list of include directories seems to work
for the official stuff, but it clearly doesn't work for the filesystem
stuff because Directory.h is not in the base\boost directory. I can
put it there myself, of course, but I'm wondering if there is some
intended way to use the beta libraries before they become a part of
the whole.
(2) Is there a "right" way to link Boost stuff with VC6? The
filesystem stuff, like the regex stuff and some other pieces, requires
actual compilation and cannot simply be included as header files. I
have already built all the official libraries using the bjam utility,
but I cannot help noticing they're each stored in hideously long paths
beneath the boost base directory. Is there a "right" directory under
the Boost hierarchy into which the resulting libs should be copied for
ease of inclusion in VC6? Or should I copy them into my project
directories as needed? Or should I simply come up with my own system?
To get to the more specific question, let me explain how I've
addressed (1) and (2) for the time being. Regarding (1), I've copied
Directory.h and Boost.h into the base\boost directory so that they may
be included without changing the existing source code. That was simple
enough. Regarding (2), I've decided to add Directory.cpp to my project
and compile it as a module, rather than try to get the linking to work
externally. Having said that, consider the following code:
#include
(1) Is there a "right" way to include Boost stuff with VC6? Adding the Boost base directory to my list of include directories seems to work for the official stuff, but it clearly doesn't work for the filesystem stuff because Directory.h is not in the base\boost directory. I can put it there myself, of course, but I'm wondering if there is some intended way to use the beta libraries before they become a part of the whole.
I searched for directory.h and directory.hpp within my boost package but couldn't find it, so I can't help you there. I downloaded Boost via CVS a few days ago so my package is probably different from yours.
(2) Is there a "right" way to link Boost stuff with VC6? The filesystem stuff, like the regex stuff and some other pieces, requires actual compilation and cannot simply be included as header files. I have already built all the official libraries using the bjam utility, but I cannot help noticing they're each stored in hideously long paths beneath the boost base directory. Is there a "right" directory under the Boost hierarchy into which the resulting libs should be copied for ease of inclusion in VC6? Or should I copy them into my project directories as needed? Or should I simply come up with my own system?
As far a I can tell the libraries and dlls get built to the hideously long directory and then are copied to someplace more convenient. For example in my case with boost.python they are built to the following long directory: E:\Code\boost\libs\python\build\bin\boost_python.dll\msvc\release\runtime-link-dynamic and then automatically copied into: E:\Code\boost\libs\python\build\bin-stage I've also setup a VC++ .dsp file for building my Boost.Python projects because I got sick of looking at the command line output generated by bjam. It seems to be working fine.
I think I'm right in saying that the dir_it library has been superseded by
the Boost Filesystem Library. This is currently under formal review under
Sep 23, at which time it will either be accepted into Boost, or rejected
See http://groups.yahoo.com/group/boost/files/filesystem/index.htm
HTH
--Craig
"John B. Williston"
Greetings,
Though I'm an "old hand" at C++, I'm a complete newbie when it comes to Boost. The piece that really caught my eye, in light of my current project, is the directory iterator. To date, however, I haven't had any success getting it to compile and function under Win32 with MSVC6, so I thought I would post here. I first have a couple of general questions about using Boost, and then one specific question about the problems with my project at hand.
(1) Is there a "right" way to include Boost stuff with VC6? Adding the Boost base directory to my list of include directories seems to work for the official stuff, but it clearly doesn't work for the filesystem stuff because Directory.h is not in the base\boost directory. I can put it there myself, of course, but I'm wondering if there is some intended way to use the beta libraries before they become a part of the whole.
(2) Is there a "right" way to link Boost stuff with VC6? The filesystem stuff, like the regex stuff and some other pieces, requires actual compilation and cannot simply be included as header files. I have already built all the official libraries using the bjam utility, but I cannot help noticing they're each stored in hideously long paths beneath the boost base directory. Is there a "right" directory under the Boost hierarchy into which the resulting libs should be copied for ease of inclusion in VC6? Or should I copy them into my project directories as needed? Or should I simply come up with my own system?
To get to the more specific question, let me explain how I've addressed (1) and (2) for the time being. Regarding (1), I've copied Directory.h and Boost.h into the base\boost directory so that they may be included without changing the existing source code. That was simple enough. Regarding (2), I've decided to add Directory.cpp to my project and compile it as a module, rather than try to get the linking to work externally. Having said that, consider the following code:
#include
#include "boost/directory.h" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { using namespace boost::filesystem; std::string strFilename;
for (dir_it it("./"); it != dir_it(); ++it) if (!get
(it)) strFilename = *it; return 0; }
This is an extremely minimal test case of integrating the filesystem stuff into a Win32 application. When compiling the application, I get the following lengthy and inscrutable (to me, at least) error message:
WinMain.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::filesystem::get<struct boost::filesystem::is_hidden>::get<struct boost::filesystem::is_hidden>(class boost::filesystem::dir_it const &)" (__imp_
??0?$get@Uis_hidden@filesystem@boost@@@filesystem@boost@@QAE@ABVdir_it@12@@Z )
The error message seems to suggest that the filesystem stuff isn't available in my project. I find that confusing because the Directory.cpp module compiles without any errors, and I am thus inclined to think that, in fact, all of the filesystem stuff is in my project. Thus, I must also ask the third question:
(3) Can anyone explain to me what I might be doing wrong and, more importantly, how I might correct it?
Thanks much to all the Boost authors for an interesting set of tools. And thanks in advance to any who respond for all the help with my specific issue.
John
On Mon, 16 Sep 2002 08:19:50 +0100, "Craig Henderson"
I think I'm right in saying that the dir_it library has been superseded by the Boost Filesystem Library. This is currently under formal review under Sep 23, at which time it will either be accepted into Boost, or rejected
Ah, ok. In that case, y'all should please accept my apologies for confusing the two. I'll see if I have any better luck with the REAL filesystem stuff. Thanks. John
Hi there, When I use boost::thread for creating multiple threads I notice that the destructor of object I pass as an argument ( boost::thread(*pObjetc) ) is called twice. Why does it happen? MDV _____ Esta mensagem foi verificada pelo E-mail Protegido Terra http://www.emailprotegido.terra.com.br/ . Scan engine: VirusScan / Atualizado em 11/09/2002 / Versco: 1.3.13 Proteja o seu e-mail Terra: http://www.emailprotegido.terra.com.br/ [Non-text portions of this message have been removed]
On Monday 16 September 2002 16:50, Marcio Del'Valle wrote:
Hi there,
When I use boost::thread for creating multiple threads I notice that the destructor of object I pass as an argument ( boost::thread(*pObjetc) ) is called twice. Why does it happen?
because boost makes a copy (acutally several!!) of the object, and then destroys them. boost calls the copy constructor to get a copy of the object you pass as a function object, and then makes another copy (don't know why) and then destroyes the "temporary" objects.
On Monday 16 September 2002 16:50, Marcio Del'Valle wrote:
Hi there,
When I use boost::thread for creating multiple threads I notice
destructor of object I pass as an argument ( boost::thread (*pObjetc) ) is called twice. Why does it happen?
because boost makes a copy (acutally several!!) of the object, and
destroys them. boost calls the copy constructor to get a copy of
--- In Boost-Users@y..., Luis De la Parra
you pass as a function object, and then makes another copy (don't know why) and then destroyes the "temporary" objects.
This is documented. The number of copies made is left to the implementation, but generally should be kept to a minimum. If you don't want "pass by value" semantics use a wrapper/adapter such as boost::ref. Bill Kempf
participants (6)
-
bill_kempf
-
Craig Henderson
-
John B. Williston
-
Luis De la Parra
-
Marcio Del'Valle
-
sashan