MacOS clang: error no input files

Hi,
yesterday I’ve finished lesson 2 in C++ about adding tekst via . I’ve saved it, compiled it, run program and everything was fine. Today I start lesson 3. I only added 2 new lines:

int a = 4;
std::cout << a;

But when I was compiling it there was a problem:

clang: error no input files

And from now it does not work anymore. Ok, maybe I did something wrong, but I don’t know what. I deleted whole project and start from the begining. I finished at the end of lesson 2 and was trying to compiling it again, but it still doesn’t work with the same error message:

Any help, please? :slight_smile:

Your terminal is in your home directory (~/) yet your file is saved in

~/Desktop/Nauka UN4/C++

You would need to cd to it,
or right click the file and open in terminal
or open the folder and open a new terminal.

Thanks again, it works. You my hero :slight_smile:

But can you tell my why it was working at the beginning and then suddenly stops? I saved my project in the same location every time and was opening it by simply run Visual Studio Code and it was already loading. I was compiling and running it a few times and everything was fine until yesterday. I’m just curious what happened.

Did you open a folder? Opening the folder in VS Code means that the terminal will open in that directory.

Yes, I’ve opened folder where I saved the game once to check what is going on in there ,during the project coding. Wow, one bad move is literally enough to break something…

So, thank you again and to next time :wink:

But I hope it won’t be necessary any time soon :stuck_out_tongue:

Opening a folder or workspace is VS Code’s way of project files so will use that as the directory to open when launching a terminal.

By default VSCode uses the root directory as the default current working directory (cwd).
If you open your preferences (Ctrl + Shift + P) and search for “terminal.cwd” you can change it to be “${fileDirname}” which would mean it would open in whatever directory the current file you have open is in.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms