Home > Enterprise >  g will not compile. fatal error: Files: No such file or directory windows
g will not compile. fatal error: Files: No such file or directory windows

Time:05-20

I am sure there is an answer out there for this but I cannot track it down.

code is simply

#include <iostream>

int main(){
  std::cout << "hello world";
  return 0;
}

Visual Studio runs the programs fine however when trying to compile from cmd

 Directory of C:\Users\ebump\OneDrive\Documents\test

05/20/2022  12:53 AM    <DIR>          .
05/20/2022  12:53 AM    <DIR>          ..
05/08/2021  06:42 PM             9,891 asuka.jpg
05/19/2022  08:18 PM        37,583,331 asuka2.jpg
05/20/2022  01:10 AM                82 steg.cpp
02/01/2021  05:32 PM        38,903,396 wet_circuits.wav
05/19/2022  08:15 PM        37,573,440 wet_circuits.zip
               5 File(s)    114,070,140 bytes
               2 Dir(s)  440,502,870,016 bytes free

C:\Users\ebump\OneDrive\Documents\test>g   steg.cpp
steg.cpp:6:1: fatal error: Files: No such file or directory

what exactly is going on?

tried to update using Msys2

below is the output of g -v stegg.cpp

Reading specs from c:/program files (x86)/codeblocks/bin/../lib/gcc/i686-w64-mingw32/4.8.3/specs
COLLECT_GCC=g  
COLLECT_LTO_WRAPPER=c:/program\ files\ (x86)/codeblocks/bin/../libexec/gcc/i686-w64-mingw32/4.8.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-4.8.3/configure --prefix=/opt/windows_32 --with-sysroot=/opt/windows_32 --libdir=/opt/windows_32/lib --mandir=/opt/windows_32/man --infodir=/opt/windows_32/info --enable-shared --disable-bootstrap --disable-multilib --with-arch=pentium3 --enable-threads=posix --enable-languages=c,c   --enable-checking=release --enable-libgomp --with-system-zlib --with-python-dir=/lib/python2.7/site-packages --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --with-gnu-ld --verbose --enable-java-home --with-java-home=/opt/windows_32/lib/jvm/jre --with-jvm-root-dir=/opt/windows_32/lib/jvm --with-jvm-jar-dir=/opt/windows_32/lib/jvm/jvm-exports --with-arch-directory=amd64 --with-antlr-jar='/home/adrien/projects/win-builds-1.5/slackware64-current/d/gcc/antlr-*.jar' --disable-java-awt --disable-gtktest --build=x86_64-slackware-linux --host=i686-w64-mingw32 --target=i686-w64-mingw32
Thread model: posix
gcc version 4.8.3 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=pentium3'
 c:/program files (x86)/codeblocks/bin/../libexec/gcc/i686-w64-mingw32/4.8.3/cc1plus.exe -quiet -v -iprefix c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/ -D_REENTRANT steg.cpp -quiet -dumpbase steg.cpp -mtune=generic -march=pentium3 -auxbase steg -version -IC:/Program Files (x86)/Codeblocks/include -o C:\Users\ebump\AppData\Local\Temp\ccUYYiRX.s
GNU C   (GCC) version 4.8.3 (i686-w64-mingw32)
        compiled by GNU C version 4.8.3, GMP version 5.1.3, MPFR version 3.1.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/program files (x86)/codeblocks/lib/gcc/../../lib/gcc/i686-w64-mingw32/4.8.3/../../../../include/c  /4.8.3"
ignoring duplicate directory "c:/program files (x86)/codeblocks/lib/gcc/../../lib/gcc/i686-w64-mingw32/4.8.3/../../../../include/c  /4.8.3/i686-w64-mingw32"
ignoring duplicate directory "c:/program files (x86)/codeblocks/lib/gcc/../../lib/gcc/i686-w64-mingw32/4.8.3/../../../../include/c  /4.8.3/backward"
ignoring duplicate directory "c:/program files (x86)/codeblocks/lib/gcc/../../lib/gcc/i686-w64-mingw32/4.8.3/include"
ignoring nonexistent directory "/opt/windows_32/opt/windows_32/lib/gcc/i686-w64-mingw32/4.8.3/../../../../include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/lib/gcc/../../lib/gcc/i686-w64-mingw32/4.8.3/include-fixed"
ignoring duplicate directory "c:/program files (x86)/codeblocks/lib/gcc/../../lib/gcc/i686-w64-mingw32/4.8.3/../../../../i686-w64-mingw32/include"
ignoring nonexistent directory "/opt/windows_32/mingw/include"
ignoring nonexistent directory "C:/Program"
#include "..." search starts here:
#include <...> search starts here:
 c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/../../../../include/c  /4.8.3
 c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/../../../../include/c  /4.8.3/i686-w64-mingw32
 c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/../../../../include/c  /4.8.3/backward
 c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/include
 c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/include-fixed
 c:\program files (x86)\codeblocks\bin\../lib/gcc/i686-w64-mingw32/4.8.3/../../../../i686-w64-mingw32/include
End of search list.
GNU C   (GCC) version 4.8.3 (i686-w64-mingw32)
        compiled by GNU C version 4.8.3, GMP version 5.1.3, MPFR version 3.1.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c4fe4d0d4d1dfaca074c710f8d712c81
steg.cpp:6:1: fatal error: Files: No such file or directory
 }
 ^
compilation terminated.

CodePudding user response:

Solved... issue was related to incorrect PATH variables

The problem was that C:\Program Files (x86)\Codeblocks\bin existed above C:\msys64\usr\bin in the system variables, so despite having updated g the system continued to look at the ancient version of g before the up to date version.

CodePudding user response:

If your program is working with Visual Studio IDE, you can compile it using VS Developer command prompt.

Please click the Start Menu, select "Developer Command Prompt for VS 2022" it will open a terminal window, then navigate to the directory where your source code is located and run the following command

cl /EHsc test.cpp  # to compile the pogram
test.exe           # to run the program

Visual Studio Command Prompt

Compile using cl compiler

  • Related