Newbie needs help w/VC6 & filesystem (take 2)
Greetings, I'm sorry for my earlier post. I didn't realize that the dir_it beta stuff was not what was being referred to as the "filesystem". I now know better, and I'm trying to make the filesystem stuff work instead. Unfortunately, I'm having no better luck. Consider the following code: #include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp #include "boost/filesystem/fstream.hpp" // ditto #include <iostream> // for cout int main(int iArgc, char** pArgv) { namespace fs = boost::filesystem; int iNumNodes = 0; fs::directory_iterator end_itr; // default construction yields past-the-end for (fs::directory_iterator itr("debug"); itr != end_itr; ++itr) { if (fs::is_directory(*itr)) std::cout << (*itr).file_path() << " (dir)" << std::endl; else std::cout << (*itr).file_path() << std::endl; iNumNodes++; } std::cout << iNumNodes << " total." << std::endl; return 0; } That's a relatively brain-dead use, I should think, to enumerate the contents of the debug folder to the console. Unfortunately, when I try compiling this, the linker complains horribly about all kinds of symbols already being defined in the filesystem object modules. To ditch the linker errors, I've temporarily used the /force switch, but that's hardly illuminating. First, can anyone tell me how to avoid getting a plethora of multiply-defined symbol errors? Or is /force my only real option? Second, if I use the /force switch, I get all kinds of unhandled exception errors when the directory iterator is constructing. Changing the string I pass to it at construction just changes which exception it emits. With the code above as written, the culprit is: template<typename Y> void reset(Y * p) // Y must be complete { BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors this_type(p).swap(*this); } That's lines 181-185 of boost/shared_ptr.hpp, and I haven't a clue why it's freaking out. Tracing through all the code shows that the exception is occurring AFTER the swap seems to succeed. I'm stumped as to what the problem might be. But I sure would appreciate any advice y'all can offer. So far I have to say that I'm impressed with the Boost library features, but it seems a cast-iron bitch to make it actually compile and link in any real-world programs. John
From: "John B. Williston"
Greetings,
I'm sorry for my earlier post. I didn't realize that the dir_it beta stuff was not what was being referred to as the "filesystem". I now know better, and I'm trying to make the filesystem stuff work instead. Unfortunately, I'm having no better luck. Consider the following code:
[...] Your example compiles and works for me (when linked with exception.cpp, path_posix_windows.cpp, and operations_posix_windows.cpp from http://groups.yahoo.com/group/boost/files/filesystem/filesystem.zip )
On Monday 16 September 2002 12:08 pm, John B. Williston wrote:
That's a relatively brain-dead use, I should think, to enumerate the contents of the debug folder to the console. Unfortunately, when I try compiling this, the linker complains horribly about all kinds of symbols already being defined in the filesystem object modules. To ditch the linker errors, I've temporarily used the /force switch, but that's hardly illuminating. First, can anyone tell me how to avoid getting a plethora of multiply-defined symbol errors? Or is /force my only real option?
We'll need more information to find the source of the problem. For instance: 1) What compiler are you using? 2) How did you build the filesystem library (with Boost Jam?) 3) How did you link the filesystem library with your program? FWIW, I've had no problems with the filesystem library on Linux with GCC. Just build with Boost Jam and link like normal... Doug
On Mon, 16 Sep 2002 13:13:00 -0400, Douglas Gregor
We'll need more information to find the source of the problem. For instance:
First, thanks for the willingness to help. Second, the answers to your questions are as follows.
1) What compiler are you using?
The compiler that came with Microsoft Visual C++ v6.0, which is currently updated with the latest service pack (i.e., SP5).
2) How did you build the filesystem library (with Boost Jam?)
Yes, I used the bjam utility.
3) How did you link the filesystem library with your program?
I copied the library built with the bjam utility into the local directory for my project--if there's a smarter way to handle the presently unofficial Boost libraries, please let me know--and then altered my project settings to include it during the link step.
FWIW, I've had no problems with the filesystem library on Linux with GCC. Just build with Boost Jam and link like normal...
Well, that's what I think I did, and it blows up in my face. Maybe I'm missing something? John
On Monday 16 September 2002 02:02 pm, John B. Williston wrote:
3) How did you link the filesystem library with your program?
I copied the library built with the bjam utility into the local directory for my project--if there's a smarter way to handle the presently unofficial Boost libraries, please let me know--and then altered my project settings to include it during the link step.
Could you copy 'n' paste some of the link errors you are getting? It seems like you did the right thing (at least, I don't know of a better way), but perhaps knowing what symbols are being redefined would help isolate the problem. Doug
On Tue, 17 Sep 2002 12:40:53 -0400, Douglas Gregor
Could you copy 'n' paste some of the link errors you are getting? It seems like you did the right thing (at least, I don't know of a better way), but perhaps knowing what symbols are being redefined would help isolate the problem.
I sure can. The following is the compile output:
--------------------Configuration: TestFs - Win32
Debug--------------------
Compiling...
Main.cpp
Linking...
LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE
specification
msvcprtd.lib(MSVCP60D.dll) : warning LNK4006: "public: __thiscall
std::basic_string
At 12:08 PM 9/16/2002, John B. Williston wrote:
Greetings,
I'm sorry for my earlier post. I didn't realize that the dir_it beta stuff was not what was being referred to as the "filesystem". I now know better, and I'm trying to make the filesystem stuff work instead. Unfortunately, I'm having no better luck. Consider the following code:
Could the problem be that you are trying to use the current Filesystem stuff with Boost 1.28.0? I've only been testing the Filesystem Library with the current Boost CVS, which has many, many changes since 1.28.0 was released. Does sample code from other Boost libraries compile and run OK for you? --Beman
On Mon, 16 Sep 2002 13:48:39 -0400, Beman Dawes
Could the problem be that you are trying to use the current Filesystem stuff with Boost 1.28.0?
I suppose so. As I hopefully indicated, I'm a complete newbie to using Boost. I've been aware of it for a while, but it was only a day or two ago that I downloaded the latest official release available. As I check the directory name, it indeed seems to be v1.28.0.
I've only been testing the Filesystem Library with the current Boost CVS, which has many, many changes since 1.28.0 was released.
Ok, so if that's the problem, then I have to plead ignorance yet again and ask another question: how do I get the "current Boost CVS"? I know CVS is some sort of versioning system, but that's about all I know about it.
Does sample code from other Boost libraries compile and run OK for you?
I do not know. The only things I've tried to use to date (viz., the dir_it and filesystem libs) both fail with all sorts of heinous errors. I haven't tried any of the other stuff yet. John
At 02:05 PM 9/16/2002, John B. Williston wrote:
On Mon, 16 Sep 2002 13:48:39 -0400, Beman Dawes
wrote: Could the problem be that you are trying to use the current Filesystem stuff with Boost 1.28.0?
I suppose so. As I hopefully indicated, I'm a complete newbie to using Boost. I've been aware of it for a while, but it was only a day or two ago that I downloaded the latest official release available. As I check the directory name, it indeed seems to be v1.28.0.
I've only been testing the Filesystem Library with the current Boost CVS, which has many, many changes since 1.28.0 was released.
Ok, so if that's the problem, then I have to plead ignorance yet again and ask another question: how do I get the "current Boost CVS"? I know CVS is some sort of versioning system, but that's about all I know about it.
See http://sourceforge.net/cvs/?group_id=7586
Does sample code from other Boost libraries compile and run OK for you?
I do not know. The only things I've tried to use to date (viz., the dir_it and filesystem libs) both fail with all sorts of heinous errors. I haven't tried any of the other stuff yet.
You also might want to spend some more time looking around the web site, and become familiar with some of the regular (non-beta, part of a regular Boost release) libraries, first. Look at the Compiler Status (http://www.boost.org/status/compiler_status.html) to make sure the library works with your compiler. HTH, --Beman
On Mon, 16 Sep 2002 20:28:38 -0400, Beman Dawes
Thanks for the link. I'm poking around there now.
You also might want to spend some more time looking around the web site, and become familiar with some of the regular (non-beta, part of a regular Boost release) libraries, first. Look at the Compiler Status (http://www.boost.org/status/compiler_status.html) to make sure the library works with your compiler.
I checked the compatibility stuff before I ever downloaded it, but thanks for the suggestion. Unless I misunderstood what I read, VC6 should only be a problem in a select few cases. John
participants (4)
-
Beman Dawes
-
Douglas Gregor
-
John B. Williston
-
Peter Dimov