Important: Please read the Qt Code of Conduct -

Problems with MAC (string.h: No such file or directory) [solved]

  • Hi my name is Jorge

    I don't know if this forum is the correct to this question, if it isn't I'm sorry...

    Since two months mi boss give me a proyect in QT developed by other person. He wanted me to learn how to compile, but in the case that he wanted to change something, he didn't have to call the developer.

    The project is in the three platforms, Windows, Linux and MAC.

    With Windows and Linux, with some little problems I got it at the end.

    The problem is MAC

    The program was developed in Mountain Lion, and I only had Snow Leopard in my hands. I concluded that the Xcode of this computer was not the necessary because when I compiled I had problems with some attributtes in some classes.

    Then now I am trying to compile in a Mountain Lion computer by remote control. In this computer, in the QtCreator aren't the compilers. I choose mannually a complier but when I compile I have this issues:

           *string.h: No such file or directory 
           algoritmic.h: No such file or directory*

    Obviusly the program should know it....

    I use libraries Qt 4.8 and Qt 5.0, any idea???

    Thanks and sorry for my english...

  • Moderators

    You need to install Command Line Tools package (it can be downloaded from Xcode in Preferences->Downloads), then set up Kits in Qt Creator (although most probably QtC will do this automatically for you).

  • I have already read this, but I haven't been able to find the preferences in the Xcode.

    I am not user of MAC, this is my first time. Correct me, I go to Finder and I write Xcode, I click in Xcode, and there isn't nothing like preferences or options menu or something like that...

    Can you send me a screenshot of the Xcode?


  • Moderators

    Xcode is an application. Double click, wait a bit, then go to top left corner of the screen (the corner of the whole desktop), there go to File->Preferences.

  • Ahhhh ok!!!! What a fool I am... I can't check it today, but as soon as possible I will tell you ...


  • Moderators

    I blame Apple ;) I'm not a big fan of OS X interface. It's more a nuisance, to be honest.

  • Hi!!!

    Finally I have a Mountain Lion MAC, but I have the same problem. I have Xcode 4.6.

    I have tried to install the command line tools, but I can´t do it.

    When I click in xcode->preferences, open a new mini-window with a lot of menus, but I can't find any place where I can install anything.


  • Moderators

    See this screenshot. It's from Xcode 4.6, too.


  • I haven't that menu, I have this menu (general, code sense, building, distribute builds, debugging, keybindings, text editing, fonts & colors, indentation, file types, opening quickly, source trees, dcm, documentation).

    If you need I send you an image.

    Thanks a lot!!!

  • Ahhhh no, I just realized that I have Xcode 3.0, the first thing I have to do is update the xcode...

    Sorry :-(

  • Moderators

    Yeah, in Xcode 3 times, Command Line Tools was a totally separate package, downloaded and installed elsewhere.

  • Yeahhh That did it!!!!

    Now I have another problem, but I don't know if is better to open a new thread or tell you in this.

    The program must be able to connect a mysql database.

    When I compile the program, Qt creates a package, only with the folders MacOS and Resources.

    But in the original package (remember the program has been developed by another person), there are this folders Frameworks, MacOs, PlugIns and Resources.

    In Frameworks and plugIns there are the libraries that the program needs to connect to mysql database.

    If I replace only the file in MacOs folder with the other, the program doesn't work, if I add the new folders to my package, the program doesn´t work...

    I don't know if I explain it well, so ask me if you have any question....


  • Moderators

    You need to use the "macdeployqt": tool.

  • I have been reading about the deployment tool but I have any doubts ...

    • Could I use QtCretor? or by terminal?

    • To have the frameworks and plugins folders, simply creates into de app folder? or Do I need to compile in a different manner?


  • Moderators

    You need to run it from terminal. If Qt is properly installed, it will do everything automatically for you (copy libs + plugins, adjust paths, add info.plist, etc.).

  • I have already compile by terminal, but the package has the same structure that if I compile wth QtCreator.

    I don't know if I need to change something in the makefile...

    Thanks a lot!!!

  • Moderators

    macdeployqt is a binary tool that has to be used after the compilation. This is not a build step specified in the makefile, and it does not matter whether you have compiled from terminal or Qt Creator. You just need to run the tool afterwards, from the terminal, and preferably with high verbosity level to make sure you spot errors (macdeployqt does not bail out on most errors).

  • Hi!!!!

    I understand MAC manner each day.

    I follow all the instructions in the web. When I execute the instructions, I have no problem.

    But when I finish linking all the libraries that my program needs, and the same with the libraries including, both my program and my libraries doesn't change anything (with the otool -L instruction)

    Thanks in advance!!!

  • Hi!!!!

    Forget my last reply, my problem is before.

    I don't know where I have to transform the Qt to a static library. The ./configure static instruction doesn't work in any place.

    I have installed Qt5.0.1 and Qt4.8.4. I use Qt4.8.4 to compile.

    The frameworks are in /Library/Frameworks and the plugins are in /Developer/Application/Qt/plugins.

    When I installed I didn't change anything.

    What I have to do???

    Super Thanks in advance!!!

    Muchas gracias por adelantado!!!

  • Moderators

    ./configure -static
    make sub-src

  • I have had an error in the last post, I use ./configure -static

    In uses this instruction in the Qt path but in my /Developer/application/Qt/ doesn't work...


  • Inside the Qt folder I have: imports qtdemo.ap phrasebooks plugins translations

  • I have realized that I have Xcode 3.0 another time I don't know why... Can be the problem?

    Ohh God I hate MAC...

  • Moderators

    You are not alone :)

    Yeah it would probably be better to upgrade to Xcode 4.x, although the compilation should work with 3.x, too.

  • But, why it's possible that MAC unistall alone things??

  • Moderators

    Sorry, I don't understand that question, please rephrase.

  • Oh nothing, I thought that when I installed the new version, automatically remove the Xcode 3.0.

  • Moderators

    Xcode 3 has a different unistallation procedure than 4.6. IIRC, you need to run /Developer/xcode_uninstall or something similar. Search the web, there are tutorials on that.

  • And it's possible that I have problems with Qt? and with ./configure instruction???

    Having both versions...

  • When I use ./configure -static, terminal answer me:

    -bash: ./configure: No such file or directory.

    Any idea??

  • Moderators

    Well, ss the script present in the directory you are in?

  • Lifetime Qt Champion

    Hi, configure is found in the root directory of Qt's sources

  • Hi!!,

    My Qt directory is in /Developer/Tools/Qt (and Qt5.0.1) and no one has configure...

  • I have installed qt-mac-opensource-4.8.4 and qt-mac-opensource-5-1.0.1-clang-offline

  • Moderators

    No need to configure, then. Your Qt is precompiled.

  • And then what is my problem?? Is problem with the linking the libraries??

  • I'm sorry, but MAC is driving me crazy... I had no problems with Windows ni Linux...

  • On the Mac a good alternative to using the Qt downloads from is to use the Brew package manager.

    Follow these instructions to install brew

    Then use it to install QT, brew install qt will install Qt4 and brew install qt5 will install Qt5.

    The nice part about using brew is that you can actually have multiple versions of Qt installed and switch between them. brew switch qt <version>

    I've also found that sometimes I had to run macdeployqt with sudo.

  • I gonna write step by step the instructions I use, in case I am confusing myself:

    For example, to link the libraries to QtNetwork.

    First of all I copy all the libraries that I need (There are in /Libraries/Frameworks) in

     * *otool -L*
             @executable_path/../Frameworks/QtNetwork.framework/Versions/4.0/QtNetwork (compatibility version 4.8.0, current version 4.8.4)
             QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.4)
             /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
      **install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore*
       **install_name_tool -change /Library/Frameworks/QtCore.framework/Versions/4.0/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore*
      * *otool -L*
             @executable_path/../Frameworks/QtNetwork.framework/Versions/4.0/QtNetwork (compatibility version 4.8.0, current version 4.8.4)
             QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.4)
             /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)

    Any idea???

Log in to reply