Missing FMT Files & Directories

102 Views Asked by At

When i attempt to compile some C++ code using the gcc compiler using the FMT library i get this error.

C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find FMT: No such file or directory
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Colours: No such file or directory
collect2.exe: error: ld returned 1 exit status

The code

#include <iostream>
#include <fmt/core.h>

int main() {
    fmt::print(fg(fmt::color::green), "This text is green.\n");
    fmt::print(fg(fmt::color::red) | fmt::emphasis::bold, "This text is bold and red.\n");
    return 0;
}

I have installed FMT.

Command to run:

cd "c:\Users\Surface Book 2\Documents\C++ Stuff\Colours\" ; if ($?) { g++ FMT Colours.cpp -o FMT Colours } ; if ($?) { .\FMT Colours }
1

There are 1 best solutions below

0
vitaut On

It looks like your paths contain spaces and therefore should be quoted, e.g.

g++ FMT Colours.cpp -o FMT Colours

changed to

g++ "FMT Colours.cpp" -o "FMT Colours"