Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.h file not found

I'm working on an app in xcode 4 and everything was going great, then something odd just started happening. Every time I make a new class (any type of class, ViewController, NSObject, etc.) and import it in another .m file I get the error "className.h" file not found.

The files are in the project and the code sense in xcode even supplies the name of the class when I am typing the #import statement.

I quit xcode then cleaned the project and that did nothing.

Any ideas, this is driving me crazy!

like image 363
Buyin Brian Avatar asked Mar 04 '11 20:03

Buyin Brian


People also ask

Why is my header file not found C++?

The error happens because C/C++ projects use an explicit list of directories to search for header files. This list is separate from the list of header files in Solution Explorer, that are only used for navigation.

Is .h necessary in C++?

Every C++ program needs at least one header file to be meaningful. For example, most C++ programs need the cin object to take input from the user and much other pre-written code, which helps to make programming easier, so to use such functionalities, you need a header file.

How do I run a .h file?

How to open an H file. Since header files are plain text files, you can open and view the file contents in a text editor. However, it's easier to edit *. h files and other source code files using a code editor like Microsoft Visual Studio or Apple Xcode.

What is .h file in Mac?

There are two types of header files in Mac OS X: Ordinary header files. These header files are inserted into source code by a preprocessor prior to compilation. Ordinary header files have an . h extension.


1 Answers

I just had the same problem and tried the above solutions. What worked for me was a clean of the project.

In the menu bar go to...

Product --> Clean

When that is complete hold down the option key and again in the menu bar go to...

Product --> Clean Build Folder

I'm not sure if the clean of the build folder was necessary. It's just become habit for me to do both. I have to do this more than I would like in Xcode.

like image 195
JDCartee Avatar answered Nov 08 '22 18:11

JDCartee