0

I tried to compile a .cpp into an .exe with two different ways, the first (following a tutorial) was by going to the files location (C:\Users\me\Desktop\CPP Files) and typing cmd and opening a prompt then typing: g++ main.cpp main.exe (i also tried the other way around, with the .exe first) and got this error: 'g++' is not recognized as an internal or external command, operable program or batch file.

on the cygwin prompt i got this error: cc1plus: fatal error: klog_main.cpp: No such file or directory compilation terminated.

How can i fix this/what am i doing wrong?

  • Maybe you are not compiling from the cygwin terminal – drescherjm Jun 21 '22 at 03:20
  • `C:\Users\me\Desktop\CPP Files` I recommend against ever putting a space in a path or a file name when using c++. Remember that most compilers work with on the command line / shell and a space in the shell separates arguments causing you to have to quote the paths. – drescherjm Jun 21 '22 at 03:21
  • Thanks for your response. I tried it on the cygwin terminal as well and got this error: cc1plus: fatal error: main.cpp: No such file or directory compilation terminated. – KawasakiBackflip Jun 21 '22 at 03:24
  • You were in the wrong folder in the terminal. `main.cpp` was not in the folder that you were in when you executed g++ – drescherjm Jun 21 '22 at 03:32
  • 1
    Side note: Cygwin can be a nuisance. Unless you need the POSIX compatibility layer Cygwin provides, [consider using msys2](https://stackoverflow.com/a/30071634/4581301). – user4581301 Jun 21 '22 at 03:37

0 Answers0