I’m trying to compile a basic c++ program with 3 files: main.cpp, file.h, and file.cpp.
When I put
c++ -pthread *.cpp it give me an error saying;
fatal error: file.h: No such file or directory
compilation terminated.
main.cpp and file.cpp both have #include "file.h"
This tell the compiler to find the header files on the current directory, and not only in the default directories (/usr/include and /include).
I suggest you for compiling this trivial example to use GNU Make. The standard rules will work for you.
Maybe, if you have the same issue (file.h not found) you can set CXXFLAGS=-I.