Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt Creator on mac osx: c++ headers not being found / boost/shared_ptr.hpp: No such file or directory
QtWS25 Last Chance

Qt Creator on mac osx: c++ headers not being found / boost/shared_ptr.hpp: No such file or directory

Scheduled Pinned Locked Moved Installation and Deployment
19 Posts 2 Posters 15.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andrinbertschi
    wrote on 24 Jul 2014, 12:48 last edited by
    #1

    I started using Qt Creator 2.8.2 on mac osx 10.9.4 for sailfish OS application development (Downloaded Qt Creator from https://sailfishos.org)

    If I want to compile a sample c++ file including header from boost, the compilation fails showing
    "fatal error: boost/shared_ptr.hpp: No such file or directory".

    I downloaded boost 1.55.0_2 with brew (brew install boost --with-c++11) and all necessary header files are in "/usr/local/Cellar/boost/1.55.0_2/include/boost" aliasing to "/usr/local/include/boost/".

    In my *.pro file, I added

    @INCLUDEPATH += /usr/local/include/@

    and

    @LIBS += /usr/local/lib/@

    But this doesn't help, I still can't use boost header files because of

    @/app/src/harbour-wlan-keyboard.cpp:41:32: fatal error: boost/shared_ptr.hpp: No such file or directory"@

    Do you have any idea whats wrong here?

    @/* Compiler output */
    14:39:44: Running steps for project harbour-wlan-keyboard...
    14:39:44: Starting: "/Users/abertschi/.config/SailfishAlpha4/mer-sdk-tools/MerSDK/SailfishOS-i486/qmake" /Users/abertschi/src-proj/sailfish-wlan-keyboard/app/harbour-wlan-keyboard.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug

    Building target platforms: i486-meego-linux-gnu
    Building for target i486-meego-linux-gnu
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.7aqDeI
    14:39:46: The process "/Users/abertschi/.config/SailfishAlpha4/mer-sdk-tools/MerSDK/SailfishOS-i486/qmake" exited normally.
    14:39:46: Starting: "/Users/abertschi/.config/SailfishAlpha4/mer-sdk-tools/MerSDK/SailfishOS-i486/make"
    Building target platforms: i486-meego-linux-gnu
    Building for target i486-meego-linux-gnu
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.T01IUh
    g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -march=i486 -fasynchronous-unwind-tables -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++ -I../app -I../app/src/lib -I/usr/local/include -I/usr/include/sailfishapp -I/usr/include/mdeclarativecache5 -I/usr/include/qt5 -I/usr/include/qt5/QtQuick -I/usr/include/qt5/QtQml -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -I. -o harbour-wlan-keyboard.o ../app/src/harbour-wlan-keyboard.cpp
    ../app/src/harbour-wlan-keyboard.cpp:41:32: fatal error: boost/shared_ptr.hpp: No such file or directory
    compilation terminated.
    @

    @
    /* sample c++ file */

    #ifdef QT_QML_DEBUG
    #include <QtQuick>
    #endif

    #include <sailfishapp.h>
    #include <iostream>
    #include <algorithm>
    #include <string>
    #include <stdexcept>
    #include <vector>
    #include <boost/shared_ptr.hpp>

    using namespace std;

    int main(int argc, char *argv[])
    {
    // SailfishApp::main() will display "qml/template.qml", if you need more
    // control over initialization, you can use:
    //
    // - SailfishApp::application(int, char *[]) to get the QGuiApplication *
    // - SailfishApp::createView() to get a new QQuickView * instance
    // - SailfishApp::pathTo(QString) to get a QUrl to a resource file
    //
    // To display the view, call "show()" (will show fullscreen on device).

    /*return SailfishApp::main(argc, argv);*/
    return 0;
    

    @
    }

    @/* pro file */
    TARGET = harbour-wlan-keyboard

    CONFIG += sailfishapp

    SOURCES += src/harbour-wlan-keyboard.cpp

    INCLUDEPATH += src/lib/
    INCLUDEPATH += /usr/local/include/

    LIBS += /usr/local/lib/

    OTHER_FILES += qml/harbour-wlan-keyboard.qml
    qml/cover/CoverPage.qml
    qml/pages/FirstPage.qml
    qml/pages/SecondPage.qml
    rpm/harbour-wlan-keyboard.changes.in
    rpm/harbour-wlan-keyboard.spec
    rpm/harbour-wlan-keyboard.yaml
    translations/*.ts
    harbour-wlan-keyboard.desktop

    to disable building translations every time, comment out the

    following CONFIG line

    CONFIG += sailfishapp_i18n
    TRANSLATIONS += translations/harbour-wlan-keyboard-de.ts@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on 25 Jul 2014, 22:02 last edited by
      #2

      What is the output of:

      ls -lh /usr/local/include/boost

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andrinbertschi
        wrote on 25 Jul 2014, 22:20 last edited by
        #3

        ls -lh /usr/local/include/boost is pointing to:

        /usr/local/include/boost -> ../Cellar/boost/1.55.0_2/include/boost

        There are all header files.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ambershark
          wrote on 25 Jul 2014, 22:21 last edited by
          #4

          Sorry I actually wanted to see the files and forgot that command would just show the link, can you:

          cd /usr/local/include/boost
          ls -lh

          and post that for me?

          Thanks.

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ambershark
            wrote on 25 Jul 2014, 22:23 last edited by
            #5

            Can you also show me the line of code that is failing, this one:

            ../app/src/harbour-wlan-keyboard.cpp:41

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andrinbertschi
              wrote on 25 Jul 2014, 22:35 last edited by
              #6

              Thanks for your support.

              I)
              @ cd /usr/local/include/boost
              ls -lh
              @

              Here is the output: https://gist.github.com/abertschi/b177e45d6258ef2aed19

              II.)

              @./app/src/harbour-wlan-keyboard.cpp:41:32: @

              is the include of the boost header file:

              @#include <boost/shared_ptr.hpp>@

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andrinbertschi
                wrote on 25 Jul 2014, 22:43 last edited by
                #7

                Btw, my os has Xcode in version 5.1.1 (5B1008) installed.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  ambershark
                  wrote on 25 Jul 2014, 22:52 last edited by
                  #8

                  Ok I don't see anything wrong so lets test a few more things:

                  1. If you cat /usr/local/include/boost/shared_ptr.hpp does it work? Do this as the user that is doing the build. Making sure there is no permission issue and that it can actually read the file.

                  2. Trying adding INCLUDEPATH += /usr/local/Cellar/boost/1.55.0_2/include to your project file. This will test to see if there is some kind of symlink issue or something.

                  Your symlink looks good, your files look good (no permissions issues I can see), and your include path in your build looks good. It should work so it's weird that it isn't.

                  My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andrinbertschi
                    wrote on 25 Jul 2014, 23:07 last edited by
                    #9

                    1.) cat /usr/local/include/boost/shared_ptr.hpp looks good. I trigger the build in Qt Creator by "Build Project". The user is the same as I used for cat.

                    2.) I have already tried to include
                    INCLUDEPATH += /usr/local/Cellar/boost/1.55.0_2/include
                    but without success. I get the same error showing "no such file or directory".

                    I packed the whole project as zip: http://abertschi.ch/default_public/qt/app.zip

                    Even if I exclude all Sailfish OS specific #includes and just include the boost library in a simple cpp file, the boost header can't be found.

                    Do you have any other idea ?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      ambershark
                      wrote on 25 Jul 2014, 23:19 last edited by
                      #10

                      This is really weird. Let's try removing Qt from it and just do:

                      @
                      // main.cpp

                      #include <boost/shared_ptr.hpp>

                      int main(int argc, char *argv[])
                      {
                      return 0;
                      }
                      @

                      Then to build (on command line):

                      @
                      g++ -I/usr/local/include -o main main.cpp
                      @

                      If that has the problem them we can try to figure it out from there, if not it's something Qt is doing and we can look further into it.

                      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        andrinbertschi
                        wrote on 25 Jul 2014, 23:24 last edited by
                        #11

                        It's weird indeed. The compilation by command line works just fine.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          ambershark
                          wrote on 25 Jul 2014, 23:27 last edited by
                          #12

                          Ok, lets make it into a Qt project and see if that works. Assuming you have an empty directory with just main.cpp in it, do

                          @
                          qmake -project
                          @

                          Then edit the resulting pro file and add:

                          @
                          INCLUDEPATH += /usr/local/include
                          @

                          Then try:

                          @
                          qmake
                          make
                          @

                          See if that builds.

                          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            andrinbertschi
                            wrote on 25 Jul 2014, 23:36 last edited by
                            #13

                            make shows me
                            @
                            make: Nothing to be done for `first'.
                            @

                            Although the code was never compiled.

                            Generated Makefile: https://gist.github.com/abertschi/d77626909a2f0a8d6912

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              andrinbertschi
                              wrote on 25 Jul 2014, 23:57 last edited by
                              #14

                              Just to keep you on track.
                              The next things I'm going to try are:

                              • Download Qt 5.3.1 and try to compile with boost headers

                              • Try to find an older Sailfish Qt release and try to compile with boost headers

                              @ambershark, I really appreciate your help, thanks a lot. If you have any other idea please let me know.

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                ambershark
                                wrote on 26 Jul 2014, 00:02 last edited by
                                #15

                                Let me see the generated pro file, or you can just try:

                                @
                                make distclean
                                qmake
                                make
                                @

                                If distclean doesn't cause a recompile, then

                                @
                                rm *.o
                                rm main
                                qmake
                                make
                                @

                                That should force the compile and we'll see what happens.

                                And boost should work even without compiling it into qt, but adding it to qt would be the better approach. This guarantees compatibility.

                                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  andrinbertschi
                                  wrote on 26 Jul 2014, 00:13 last edited by
                                  #16

                                  @make distclean @

                                  or

                                  @rm *.o @

                                  don't help. No out files were generated.

                                  @ make: Nothing to be done for `first'.@

                                  All I get is the above message and the Makefile:

                                  @
                                  drwxr-xr-x 5 abertschi staff 170 26 Jul 02:08 .
                                  drwxr-xr-x 5 abertschi staff 170 26 Jul 01:35 ..
                                  -rw-r--r-- 1 abertschi staff 4891 26 Jul 02:08 Makefile
                                  -rw-r--r-- 1 abertschi staff 83 26 Jul 01:29 main.cpp
                                  -rw-r--r-- 1 abertschi staff 302 26 Jul 02:08 qt-proj.pro
                                  @

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    ambershark
                                    wrote on 26 Jul 2014, 00:29 last edited by
                                    #17

                                    Let me see that qt-proj.pro file...

                                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      andrinbertschi
                                      wrote on 26 Jul 2014, 14:09 last edited by
                                      #18

                                      @######################################################################

                                      Automatically generated by qmake (2.01a) Sa. Jul 26 01:29:05 2014

                                      ######################################################################

                                      TEMPLATE = subdirs

                                      SOURCES += main.cpp

                                      Directories

                                      INCLUDEPATH += /usr/local/include
                                      @

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        ambershark
                                        wrote on 26 Jul 2014, 22:53 last edited by
                                        #19

                                        Ok there's the problem. It is using a subdirs template. Not sure why it would have generated that.

                                        Make a new pro file with this:

                                        @
                                        TEMPLATE = app
                                        TARGET = main
                                        INCLUDEPATH += /usr/local/include .
                                        QT += core

                                        SOURCES += main.cpp
                                        @

                                        Then try building.

                                        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                                        1 Reply Last reply
                                        0

                                        4/19

                                        25 Jul 2014, 22:21

                                        topic:navigator.unread, 15
                                        • Login

                                        • Login or register to search.
                                        4 out of 19
                                        • First post
                                          4/19
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved