0

I am trying to apply this workaround for compiling c++20 code with the current gcc-11 compiler, in particular std::format(). Its from the associated book 'beginning c++20'.

I followed step 1 (from the link) by downloading the relevent directories for the library resulting in having the path /home/myName/Workarounds/fmt on my system then followed the instructions for step 2 by using the command:

gcc -I /home/myName/Workarounds

Which is meant to add the Workarounds directory to the additional include paths of my compiler

But I just get the error:

gcc: fatal error: no input files

I'm a beginner with c++ so I don't really know what I'm doing, what command do I need to use to add the correct directory to my compiler path?

Many thanks!

azzt596
  • 3
  • 1
  • 1
    You can't "add a path" to compiler forever. You add it when you compile your project. Lets, say, your project has a file called `main.cpp`, then, when you want to compile it with this library, you run `g++ -I /home/myName/Workarounds main.cpp` and it should create a binary called `a.out`. – Yksisarvinen Jul 19 '21 at 11:47
  • @Yksisarvinen Thanks. Do you know if there's a way to set VSCode to add this argument automatically when I click 'run' in the console? I am using Ubuntu and it seems to work differently to the Windows version which is described in the instructions. – azzt596 Jul 19 '21 at 12:17
  • I never used VSCode, but it uses JSON files to produce parameters for compiler. Try [this](https://stackoverflow.com/questions/46258143/visual-studio-code-how-to-configure-includepath-for-better-intellisense-results) or [this](https://stackoverflow.com/questions/52910102/vscode-c-task-json-include-path-and-libraries) question – Yksisarvinen Jul 19 '21 at 12:21

0 Answers0