1

多くの人 (例12 ) が職場への行き方について尋ねてstd::filesystem::directory_iteratorきましたが、それらを読んでもまだ問題があります。

小さな静的ライブラリを構築しようとしています。ディレクトリ イテレータをいくつかのソース ファイルに追加した後、gcc を更新し、-lstdc++fsビットを追加しましたが、エラー メッセージが表示され続けるため、何も機能していないようです。

fatal error: filesystem: No such file or directory
 #include <filesystem>

入力gcc --versionすると、取得します

gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

そして、私がタイプgcc-8 --versionすると、

gcc-8 (Ubuntu 8.1.0-1ubuntu1) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

すべてをコンパイルする小さなシェル スクリプトを次に示します。他のバリエーションもいくつか試しました。

EIGEN=/usr/include/eigen3

cd ./bin
for file in ../src/*cpp; do
        g++ -std=c++11 -fPIC -c -I$EIGEN -I../include -O3 $file "-lstdc++fs"
done    
ar crv libfoo.a *.o
cd ..
4

1 に答える 1