Skip to content

'tfile.h' file not found - Xcode 4.5.2 #90

Vdue opened this Issue Dec 14, 2012 · 2 comments

2 participants

Vdue commented Dec 14, 2012

I am using Xcode 4.5.2 on OSX 10.8.2

I downloaded the latest TagLib.framework and added the framework to my project.

If I am doing a simple (here I left out the brackets in the imports):
#import TagLib/TagLib.h
#import taglib/tag.h
#import taglib/fileref.h
TagLib::FileRef f("test..mp3");

I get a compiler error:
.../taglib.framework/Headers/fileref.h:29:10: 'tfile.h' file not found

The framework files are sitting in .../Documents/XCode/Frameworks. I included the folder in the Header Search Path

Vdue commented Dec 16, 2012

Did not manage to get the taglib.framework up and running, so I produced a dylib file:

download the taglib-master files and do cmake, make and install according to the INSTALL instructions of taglib-master in the terminal window:
$ make
$ sudo make install

this produces:

open a new blank XCode project

  • drag: /usr/local/lib/libtag.1.12.0.dylib into the project (file shows-up in the Link Library) Under PROJECT -> Build Settings define:
  • Header Search Paths /usr/local/include/taglib
  • Library Search Paths /usr/local/lib

the project file in which you are going to make the include statements rename from .m to .mm (since we are mixing languages)


  • (void) readMp3 {
    TagLib::FileRef f("YourMusicFile.mp3");

    NSString *artist = [[NSString alloc] initWithCString:f.tag()->artist().toCString() encoding:NSUTF8StringEncoding];
    NSLog(@"artist %@", artist);

TagLib member
scotchi commented Dec 17, 2012

I'm not sure where you got the framework from, but the Framework generated by cmake this way with cmake works fine:

cmake -DBUILD_FRAMEWORK=true . && make

After adding tag.framework to a project doing 'import "tag/tfile.h" from a .mm file works fine.

Your second error is also not a bug. You need to add [install-dir]/include/taglib to your header search path. This is mentioned in "Installing TagLib" in the front page of the API docs:

"Note that TagLib's include install directory must be included in the header include path. Simply adding will not work."

@scotchi scotchi closed this Dec 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.