QT Creator autocomplete for structs and functions from OS X headers



  • Hello,

    I'm using Qt Creator 3.3 to develop my Qt based applications on OS X Yosemite. Syntax highlighting and autocompletion works well for std c++ an Qt but not for structs and functions from OS X headers.

    It look like that Qt Creator can't find these headers. I.e. the statement #include <CoreAudio/CoreAudio.h> is underlined (means not found). Compiling and linking works fine (Framework is included in project file: LIBS += -framework CoreAudio). Is there any way to tell Qt Creator how to find OS X headers?

    Thanks for help
    Axel



  • Hello,

    after a long search I found an unsatisfactory solution.
    The directories in which the headers of the SDK lie have a peculiar structure. It's a mystery for me that the compiler find these header files.

    My Solution:
    I've written a small php shell script. It creates a directory with symbolic links to all header directorys of the SDK frameworks.

    @
    <?php

    $sdk = "MacOSX10.10.sdk";
    $sdk_dir = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/".$sdk."/System/Library/Frameworks/";
    $out_dir = "~/include_".$sdk;

    if(!is_dir($out_dir))
    {
    mkdir($out_dir);
    }

    $d = dir($sdk_dir);
    while( FALSE !== ($f = $d->read()) )
    {
    if( !is_dir($sdk_dir.$f) )
    continue;
    if( ".framework" != substr($f,-strlen(".framework")))
    continue;
    if( is_dir($sdk_dir.$f."/Headers") )
    symlink( $sdk_dir.$f."/Headers", $out_dir."/".substr($f,0,-strlen(".framework")));
    }
    @

    In my .pro file I add this directory to the INCLUDEPATH variable.

    In this way Qt-Creator finds what it needs!

    The disadvantage is. The compiler is disturbed by this INCLUDEPATH, so I always have to remove this entry before compiling.

    Maybe someone knows a better solution?

    Thanks
    Axel


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.