#include <boost/filesystem.hpp>
#include <iostream>
#include <string>
#include <stdlib.h>
int main(int argc, char* argv[])
{
boost::filesystem::path my_path("/root/yijunjun.txt");
my_path.clear();
return 0;
}
makefile文件部分:
filesystem:main.o
g++ -o $@ $< -lboost_filesystem-gcc42-mt
main.o:main.cpp
g++ -c $<
clean:
rm -rf *.o
rm -rf filesystem
编译出错提示:
error: ‘struct boost::filesystem::path’ has no member named ‘clear'
其它函数没有这样的错误,这个错误有两点比较奇怪。
第一:
在其文档中明明的如此说明
明明
#include <iostream>
#include <string>
#include <stdlib.h>
int main(int argc, char* argv[])
{
boost::filesystem::path my_path("/root/yijunjun.txt");
my_path.clear();
return 0;
}
makefile文件部分:
filesystem:main.o
g++ -o $@ $< -lboost_filesystem-gcc42-mt
main.o:main.cpp
g++ -c $<
clean:
rm -rf *.o
rm -rf filesystem
编译出错提示:
error: ‘struct boost::filesystem::path’ has no member named ‘clear'
其它函数没有这样的错误,这个错误有两点比较奇怪。
第一:
在其文档中明明的如此说明
class basic_path:第二:
basic_path& operator/=(const basic_path& rhs);
basic_path& operator/=(const string_type& s);
basic_path& operator/=(const value_type* s);
template <class InputIterator>
basic_path& append(InputIterator first, InputIterator last);
void clear();
void swap( basic_path & rhs );
basic_path& remove_leaf();
明明
typedef basic_path<std::string, path_traits> path;
应该来说是一个类类型,怎么会提示struct呢?
特此记下。