Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Solved] Using QtCreator/QMake with clang/libclangTooling

[Solved] Using QtCreator/QMake with clang/libclangTooling

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 3 Posters 6.7k 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.
  • C Offline
    C Offline
    codenode
    wrote on last edited by
    #1

    Hi,

    actually postet this to the clang-dev list, but they insisted, that its probably a qmake / QtCreator issue. Not sure about it, but maybe someone can give me a hint.

    Here is the problem:

    trying to setup my dev env for C++ Refactoring under Windows, one of my goals is to use Qt as a Frontend for my tools.
    And QtCreator as an IDE for the whole thing. I could get cmake to build with the mingw supplied by Qt, also I could build the cbp Version with cmake, so I can open LLVM in CodeBlocks or QtCreator. Its even compiling.

    So actually, I'm ready to start, my first goal is to get this running with qmake. Just to have a start to work from. So, I've searched the clang-dev list and the net, and have not found anything on this. So, I thought, its maybe a good Idea to ask on the Qt forums. Has someone else got this running with QMake under Windows with QtCreator?

    So actually, I'm ready to start, my first goal is to build the PrintFunctionName Example with qmake. But it seems not to be enough to hand the include directories and the libraries to qmake to make it compile. Some minor issues I could resolve, but I'm stuck on this:

    %llvm%/%clang%/some/dir/DataTypes.h:
    @/* Handle incorrect definition of uint64_t as u_int64_t */
    #ifndef HAVE_UINT64_T
    #ifdef HAVE_U_INT64_T
    typedef u_int64_t uint64_t;
    #else

    error "Don't have a definition for uint64_t on this platform"//

    #endif
    #endif@

    This fails always, I have a stdint.h which defines uint64_t, but in this case, the header fails to detect this. Tried already to define HAVE_UINT_64_T etc.
    Now, note, that I can build for exact compiler with cmake and qmake should not be so different. My current qmake file:

    @#DEFINES += HAVE_STDINT_H

    #INCLUDEPATH += C:/qt/2010.03/mingw/include // doesnt need it, just a try
    INCLUDEPATH += C:/cpp/boost_1_49_0 //for boost/cstdint.hpp
    INCLUDEPATH += C:/cpp/llvm/tools/clang/include
    INCLUDEPATH += C:/cpp/llvm/include

    // linker yet not invoked, may some missing here, but I know which...
    LIBS += C:/cpp/llvm/mybuild/lib/libclangTooling.a

    // when using not boost/cstdint need to define them here
    DEFINES += __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS __STDC_LIMIT_MACROS _GNU_SOURCE@

    Has someone expierence with getting this setup to run?
    How is CMake setting the environment up? I've read through the generated makefiles, but could not find any difference which explains this.
    The other 535 Errors I think are probably also from some config/setup problems.

    kind regards,

    Jens Weller

    1 Reply Last reply
    0
    • C Offline
      C Offline
      codenode
      wrote on last edited by
      #2

      So, this works now.

      If you wanna use the clang refactoring apis in Qt Creator for your self, howto:

      build clang with cmake for MinGW.

      Use MinGW version of Qt in QtCreator, to compile a simple tool this is the needed qmake file:

      @SOURCES += main.cpp

      DEFINES += __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS __STDC_LIMIT_MACROS _GNU_SOURCE

      INCLUDEPATH += C:/cpp/boost_1_49_0
      INCLUDEPATH += C:/cpp/llvm/mybuild/include
      INCLUDEPATH += C:/cpp/llvm/tools/clang/include
      INCLUDEPATH += C:/cpp/llvm/include
      INCLUDEPATH += C:/cpp/llvm/mybuild/tools/clang/include

      LIBS += C:/cpp/llvm/mybuild/lib/libclangTooling.a@

      The include for llvm has to come after the one for your build.
      Also you need to add a few more libs from clang, in order to successfully link one of the examples in QtCreator.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        Please mark your post as solved. This helps others when looking for the same problem.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vishu
          wrote on last edited by
          #4

          Hi codenode ,
          How you made it work..? Please can you explain in detail,
          I am using Qt 5.0.2 and windows 7 , and i just downloaded llvm 3.3 and clang 3.3. How can i compile my code with clang and how to generate the bitcode using llvm.
          Thanks

          1 Reply Last reply
          0

          • Login

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