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. Fail to link header files
QtWS25 Last Chance

Fail to link header files

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
6 Posts 3 Posters 1.6k 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.
  • P Offline
    P Offline
    Penguin
    wrote on 16 Aug 2016, 13:43 last edited by
    #1

    Hi :)

    I am using Code:Blocks to compile my code on Raspbian. I have already listed all the QT4 header file directories in the search directory under compiler. When I code, everything works normally, but when I build my code, it can't link the header files.

    For what I mean is in my code, i #include <QApplication>. After that when I attempt to build it the error rises in qapplication.h, stating that #include <qtcore/size.h> is invalid, size.h is not found. (The include is just example, I am just using that to state my problem)

    I am positive that the files are all there, it's just in the same folder as qapplication.h

    I am wondering what step did I missed. Is this because I wrongly declared the environment variables? Or is because it should be #include <qtcore/size>? If so, how should I edit the header files? I didn't list the .dll files in the search directory, as from what I know there shouldn't be any.

    While working in windows there aren't any problems though. I am new here, and I hope to learn more, thus I insist using Code:Blocks because I have to do a lot of things manually.

    Hoping for answers :) Thanks

    1 Reply Last reply
    0
    • C Offline
      C Offline
      crisosphinx
      wrote on 16 Aug 2016, 16:51 last edited by crisosphinx
      #2

      Well, I'm not really skilled with this stuff yet (still a newbie, learning). But it looks like, if you're having an issue with qapplication.h, you may need to...

      #include "qapplication.h"
      

      If your personal header file is screwed up, you may need to...

      #include "yourapp.h" 
      

      in the .cpp file.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nischu
        wrote on 16 Aug 2016, 19:24 last edited by
        #3

        Have you tried the -Idir option? This puts a directory to the standard search path for default headers.
        Maybe, there is missed such an option to the compiler configuration settings at your codeBlocks IDE.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Penguin
          wrote on 17 Aug 2016, 11:15 last edited by
          #4

          To crisosphinx,

          I tried but results to the same error.

          To nischu,

          No, I haven't try the -ldir option. What's that suppose to be?

          From learcpp.com:
          “#include <filename> tells the preprocessor to look for the file in a special place defined by the operating system where header files for the C++ runtime library are held. ”

          I didn't define anything to the Raspbian... is that the case? How should I define it then?

          C 1 Reply Last reply 17 Aug 2016, 12:09
          0
          • P Penguin
            17 Aug 2016, 11:15

            To crisosphinx,

            I tried but results to the same error.

            To nischu,

            No, I haven't try the -ldir option. What's that suppose to be?

            From learcpp.com:
            “#include <filename> tells the preprocessor to look for the file in a special place defined by the operating system where header files for the C++ runtime library are held. ”

            I didn't define anything to the Raspbian... is that the case? How should I define it then?

            C Offline
            C Offline
            crisosphinx
            wrote on 17 Aug 2016, 12:09 last edited by
            #5

            @Penguin

            """
            “#include <filename> tells the preprocessor to look for the file in a special place defined by the operating system where header files for the C++ runtime library are held. ”

            I didn't define anything to the Raspbian... is that the case? How should I define it then?
            """

            That is why I suggested #include "qapplication.h" and #include "yourapp.h". It references either the QApplication header file or the header file from your project. But if my suggestion didn't work, what does your .pro file look like? There may be an issue located within that.

            I am working on a project within Raspbian as well, but pre-creating my program on my Windows PC and compile-testing on my PC before I swap it over. I've not noticed any sort of issue outside of file structure/ folder structure in Raspbian (because it's a Linux OS). If you wish, I can message you later when I get back home and help debug your issue.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Penguin
              wrote on 18 Aug 2016, 08:01 last edited by
              #6

              @chrisosphinx

              My .pro file:

              QT += core gui

              CONFIG += debug

              TARGET = MA1
              TEMPLATE = app

              HEADERS += functions.h
              SOURCES += main.cpp
              SOURCES += display_window.cpp
              SOURCES += question_generator.cpp

              !exists(main.cpp)
              {
              error("No main.cpp file found")
              }

              So I retried your suggestion and noticed something:

              When I #include <QPushButton>, the folder Code:Blocks look up is /usr/include/qt4/QtGui/qpushbutton.h

              When I #include “qpushbutton.h”, the folder is /usr/include/qt4/QtGui/qpushbutton.h

              That's the only difference I got, and I'm not sure if that's the whole main point of my mistake so I decided to show them to you

              The message is the same “fatal error: QtGui/qabstractbutton.h: No such file or directory”

              While the qpushbutton.h #include <QtGui/qabstractbutton.h>

              By the way I got curious and check if the header file is really in the directory... Well it sure is...

              Lot of thanks!

              1 Reply Last reply
              0

              5/6

              17 Aug 2016, 12:09

              • Login

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