Beginner's Program with Compile Error "No such file or directory"

已回答

When I created a main.cpp, Person.cpp, and Person.h file only CLion compiled. After I added Tweeter.cpp and Tweeter.h files, CLion no longer compiled and throws the error: "Tweeter.h: no such file or directory.This error pointed to a line my main.cpp file.

Tweeter.cpp and Tweeter.h files are found in the cmake-build-debug file

Person.cpp and Person.h files are found in the Project file.

UPDATE: I figured it out. It took me 3 whole hours, but I'm leaving this up for anyone else who might now be aware of what's going on.

 

I think CLion was holding out on me long enough to see how much patience I had and how level my head was in the moment LOL.

It literally SHOWED me what to do through a suggestion.

I needed to make sure I provided the EXACT file path in the #include statement. So instead of writing #include "what.h"  I needed to write #include "cmake-build-debug/what.h."

 

It's nice to figure things out for yourself, but what's even better for me is knowing I didn't get upset or frustrated. I just kept trying. Now, how can I avoid having to type out the whole path to the file????

 

 

0

请先登录再写评论。