2015-05-07 8 views
23

मैं filesystem का उपयोग करने की कोशिश कर रहा हूं। मेरे CMakeLists.txt में मेरे पास -std=c++11 -std=c++1y है। जीसीसी संस्करण 4.9.2 है।मैं g ++ 4.9.2 के साथ <प्रयोगात्मक/फाइल सिस्टम> का उपयोग क्यों नहीं कर सकता?

/home/loom/MyProject/src/main.cpp:5:35: fatal error: experimental/filesystem: No such file or directory 
#include <experimental/filesystem> 
           ^
compilation terminated. 

std::experimental::filesystem उपयोग करने का अधिकार तरीका क्या है: हालांकि, मैं एक त्रुटि मिल गया है?

+0

ऐसा लगता है कि वर्तमान में केवल [हेड] के साथ काम करता है (http://melpon.org/wandbox/permlink/abzPdCEgfwCCct22) –

उत्तर

25

अगर हम libstdc++ status को देखो हम देखते हैं कि वे टीएस फाइल सिस्टम के लिए समर्थन करते हैं:

Paper | Title | Status

........

N4100 | File System | Y

लेकिन यह कहते हैं:

This page describes the C++14 and library TS support in mainline GCC SVN, not in any particular release.

और से Wandbox यह कैसा दिखता पर इस कोशिश कर रहा यह पुस्तकालय केवल नवीनतम विकास शाखा 6.0 पर उपलब्ध है और मुझे उससे अधिक विवरण नहीं मिल रहा है।

जोनाथन Wakely से अद्यतन

अद्यतन:

It's also now available in the gcc-5-branch in Subversion, and will be included in the GCC 5.3 release later this year.

जोनाथन Wakely के answer here को

इसके अलावा उसके अनुसार हम -lstdc++fs का उपयोग कर संकलित करने के लिए की जरूरत है। यह Linking section of gcc documents में शामिल है:

GCC 5.3 includes an implementation of the Filesystem library defined by the technical specification ISO/IEC TS 18822:2015. Because this is an experimental library extension, not part of the C++ standard, it is implemented in a separate library, libstdc++fs.a, and there is no shared library for it. To use the library you should include and link with -lstdc++fs. The library implementation is incomplete on non-POSIX platforms, specifically Windows support is rudimentary.

Due to the experimental nature of the Filesystem library the usual guarantees about ABI stability and backwards compatibility do not apply to it. There is no guarantee that the components in any header will remain compatible between different GCC releases.

इसके अलावा Table 3.1. C++ Command Options देखते हैं।

+1

यह अब सबवर्जन में 'जीसीसी -5-शाखा' में भी उपलब्ध है, और इसमें शामिल किया जाएगा इस वर्ष के अंत में जीसीसी 5.3 रिलीज। –

+1

@ जोनाथन वाक्ली [यह सवाल] (http://stackoverflow.com/q/33149878/1708801) एक अच्छा संबंधित प्रश्न है। –

संबंधित मुद्दे