<環境>
Mac、vscode、言語はC++
<やりたいこと>
g+-11で、fmtライブラリを使いたいのですが、以下のエラーが出ますので、解決方法のアイディアをご教示いただけますと幸いです。
$ cd "[ディレクトリ名]" && g++-11 -std=c++20 test.cpp -o test && "[ディレクトリ名] /"test test.cpp:4:10: fatal error: fmt/format.h: No such file or directory 4 | #include <fmt/format.h> | ^~~~~~~~~~~~~~ compilation terminated.
なお、
$ cd "[ディレクトリ名]" && g++ -std=c++20 test.cpp -o test && "[ディレクトリ名] /"test
だとコンパイル・実行できますのでやや混乱しています。
実行したいプログラムは
#include <iostream> #define FMT_HEADER_ONLY #include <fmt/format.h> using namespace std; using namespace fmt; int main() { cout<<format("The answer is {}.", 100); }
<現状の設定>
c_cpp_properties.json
1{ 2 "configurations": [ 3 { 4 "name": "Mac", 5 "includePath": [ 6 "/usr/local/include" 7 ], 8 "defines": [], 9 "macFrameworkPath": [ 10 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/" 11 ], 12 "intelliSenseMode": "macos-clang-x86", 13 "compilerPath": "/usr/local/bin/g++-11", 14 "cppStandard": "c++20", 15 "cStandard": "c17", 16 "browse": { 17 "path": [ 18 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/", 19 "/usr/local/include" 20 ] 21 } 22 } 23 ], 24 "version": 4
また、includePathの/usr/local/include
には、fmtフォルダ、またその中にformat等のファイルが格納されていることを確認済みです。