I have a file called playback_type.h with only this code in it:
#include <iostream>
enum playback_type {
NOTE_PB, SONG_PB
};
Xcode lets me include the file fine, it even autocompletes the filename but when I try to build it I’m getting all sorts of errors.
#include <playback_type.h> // Error: `playback_type.h` file not found
class PlaybackHelper{
private:
// Singleton methods
PlaybackHelper();
PlaybackHelper(PlaybackHelper const&);
void operator=(PlaybackHelper const&);
playback_type type; // Error: 'playback_type' does not name a type
public:
void setPlaybackType(playback_type aType); // Error: 'playback_type' has not been defined
//singletong method
static PlaybackHelper &getInstance();
}
Any ideas why I’m getting those erros? The .h file is included correctly, xcode helps me autocomplete it so it should be there.
Angle brackets (
<>) are used do indicate system headers, and quotes ("") to indicate local headers. Usually, the preprocessor will look for local headers in your project directory, but won’t look for system headers there unless you specifically tell it to. So you should use quotes for your own headers: