Framework headers



  • I am attempting to include a non-Qt framework into a standard Qt Gui application project. I have included in my .pro file:
    LIBS += -F</Users/myname/Macintosh_HD/Library/Frameworks -framework <ExternalFramework.framework>
    AND
    #include "externalframeworkheader.hpp"
    IN MY main.cpp FILE.
    I also right-clicked on my project directory to "Add Existing Files" and added the externalframeworkheader.hpp file (though this process actually added the folder with its path that contains the externalframeworkheader.hpp file that I am trying to include, not just the externalframeworkheader.hpp file alone), but this addition also did not get rid of my single "'csound.hpp' file not found" error.
    After those techniques I still get the same 1 single error:
    'externalframeworkheader.hpp' file not found
    Any help with this problem would be greatly appreciated. Thank you.


  • Lifetime Qt Champion

    Hi,

    What framework is that ?
    Where did you get it from ?



  • The framework's real name is CsoundLib64.framework. Sorry for any confusion. I got it from the csound website "csounds.com" when I downloaded the "csound-develop" developer tools, version 6.10.0 from there.


  • Lifetime Qt Champion

    QMAKE_CXXFLAGS += -F/path/to/folder/containing/the/framework
    LIBS += -F/path/to/folder/containing/the/framework -framework CsoundLib64
    

    The first line is to generate the include path that allows you to write #include <CsoundLib64/csound.h>
    The second is for the linking.



  • The only error I got after I added your two lines of code is:
    'CsoundLib64/csound.h' file not found
    I entered '#include <CsoundLib64/csound.h>' at the top of my mainwindow.h file but the compiler doesn't seem to be picking it up. Any suggestions would be greatly appreciated.


  • Lifetime Qt Champion

    Not knowing how your project is made, try with QMAKE_CFLAGS in place of QMAKE_CXXFLAGS.



  • I tried your C based technique but I'm still getting the same ''CsoundLib64/csound.h' file not found' error. I think the problem might actually be because the path to the CsoundLIb64.framework is this:
    ../CsoundLib64.framework/Headers/csound.h
    NOT CsoundLib64.framework/csound.h.
    This is a simple problem but I haven't found an alternate path and include pair for my .pro and mainwindow.h files. Again, any suggestions would be appreciated.



  • I fixed the immediate problem but I am working with a toolset that is new to me so there's a chance I'll be back in this forum sometime relatively soon. Thank you very much for your help.


  • Lifetime Qt Champion

    No it's not, macOS framework headers are expected to be found in the Headers subfolder and should be included using the #include <FrameworkName/includename.h> statement.

    Please show your .pro file.

    From what you wrote I suspect you are using relative paths to source folder which is not a good idea. Use $$PWD if you are doing that to ensure that tools get a the full path to where your framework is.



  • @SGaist
    Here is my .pro file starting with the sources:
    SOURCES +=
    main.cpp
    mainwindow.cpp

    HEADERS +=
    mainwindow.h
    ../5.10.1/clang_64/NewBuildLocation/portaudio.h
    ../5.10.1/Src/qtbase/examples/NewBuildLocation/portmidi.h
    ../5.10.1/Src/qtbase/examples/qmake/NewBuildLocation/porttime.h
    ../CsoundLib64.framework/Versions/6.0/Headers/csound.hpp \

    FORMS +=
    mainwindow.ui

    LIBS += -lportmidi
    -lportaudio

    QMAKE_CXXFLAGS += -F~/Library/Frameworks/CsoundLib64.framework/Headers
    LIBS += -F~/Library/Frameworks -framework CsoundLib64

    macx: LIBS += -L$$PWD/../5.10.1/clang_64/NewBuildLocation/ -lportmidi

    INCLUDEPATH += $$PWD/../5.10.1/clang_64/NewBuildLocation
    DEPENDPATH += $$PWD/../5.10.1/clang_64/NewBuildLocation

    macx: LIBS += -L$$PWD/../5.10.1/clang_64/NewBuildLocation/ -lportaudio

    INCLUDEPATH += $$PWD/../5.10.1/clang_64/NewBuildLocation
    DEPENDPATH += $$PWD/../5.10.1/clang_64/NewBuildLocation

    mac: LIBS += -F$$PWD/../../../../Library/Frameworks/ -framework CsoundLib64

    INCLUDEPATH += $$PWD/../../../../Library/Frameworks
    DEPENDPATH += $$PWD/../../../../Library/Frameworks

    When I attempt to #include csound.hpp into my .pro file, w/control-right-click "Add existing files" Qt Creator generates, what I think is, a RELATIVE path shown above in the last line of the "HEADERS" section of my .pro file shown above as
    ../CsoundLib64.framework/Versions/6.0/Headers/csound.hpp
    When I attempt to include an existing library into my .pro file, CsoundLib64.framework here, w/control-right-click "Add libraries"
    Qt Creator generates, what I think is, an ABSOLUTE path shown above as
    mac: LIBS += -F$$PWD/../../../../Library/Frameworks/ -framework CsoundLib64
    in the last section of my .pro file.

    These are the two techniques I used to implement the necessary library/framework and header files into my .pro file.
    When including csound.hpp into my main.cpp file I use
    #include <CsoundLib64.framework/csound.hpp>
    at the top of my main.cpp (where my actual code implementation goes - left out here), I get the error:
    'CsoundLib64.framework/csound.hpp' file not found
    When I change my main.cpp #includeS to
    #include <CsoundLib64.framework/Versions/6.0/Headers/csound.hpp>
    or
    #include <CsoundLib64.framework/Headers/csound.hpp>
    which are two ways to #include my csound.hpp header fIle, that (might) complement my .pro file above I get these two errors:
    symbol(s) not found for architecture x86_64 &
    linker command failed with exit code 1 (use -v to see invocation)
    I know that the second error means that something in my project isn't linking, but I don't know what the second error implies.
    Any assistance with these build errors and information of Qt build processes in general would be greatly appreciated.


  • Lifetime Qt Champion

    Don't use the ~ that's a bash shortcut that must be interpreted.

    Then your -F value is wrong, you have to put there the path to the folder that contains the .framework you want to use. It's an equivalent of the -L parameter for libraries.



  • @SGaist
    I have fixed the problem - I'm now implementing the tools that I have wanted to implement without any long lasting errors. I just started a new project over and doing that led me to solve my problems (along with your techniques & guidance) though I would like to leave it out of this context here in the forum.
    Thank you for your time and patience.
    Patrick


Log in to reply