Boost logo

Boost Users :

From: Daniel Lord (daniel_at_[hidden])
Date: 2008-02-23 19:00:16


This is a specific error with Xcode 3.0 on Leopard not a generic Boost
question:
Something is screwy with the paths between Boost and Xcode:

Xcode 3.0 needs to find the Boost includes, so I added my directory
containing the top of the Boost tree (the boost_1_34_1 directory) to the
User header Search paths in the build configuration for the target. No
problem, everything appears to be found.
However, adding that search path screws up something else:

An error pops up in c++locale.h highlighting the line:

   const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);

and claiming: "error: 'snprintf' is not a member of 'std'." What the freak?

It compiles fine from the command line with g++ and using -I<same path to
boost as above>. So it is some wierd interaction with Boost and Xcode paths
but it make no sense to me. It's almost as if Boost is redefining something.
But what?

This does not occur if I don't add the Boost search paths but of course then
the Boost definitions are not found.

The program is a simple one from O'Reilly's C+++ Cookbook show below:

#include <boost/filesystem/operations.hpp>

#include <boost/filesystem/fstream.hpp>

#include <iostream>

using namespace boost::filesystem;

int main(int argc, char** argv) {

 if (argc < 2) {

std::cerr << "Usage: " << argv[0] << " [dir name]\n";

return(EXIT_FAILURE);

}

 path fullPath = // Create the full, absolute path name

system_complete(path(argv[1], native));

 if (!exists(fullPath)) {

std::cerr << "Error: the directory " << fullPath.string( )

<< " does not exist.\n";

return(EXIT_FAILURE);

}

 if (!is_directory(fullPath)) {

std::cout << fullPath.string( ) << " is not a directory!\n";

return(EXIT_SUCCESS);

}

 directory_iterator end;

for (directory_iterator it(fullPath);

 it != end; ++it) { // Iterate through each

// element in the dir,

std::cout << it->leaf( ); // almost as you would

if (is_directory(*it)) // an STL container

std::cout << " (dir)";

std::cout << '\n';

}

return(EXIT_SUCCESS);

}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net