Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linker Errors always after instantiation
QtWS25 Last Chance

Linker Errors always after instantiation

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 922 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.
  • M Offline
    M Offline
    Machsanity
    wrote on last edited by
    #1

    Hey all,

    I'm getting very frustrated with QT and I would like some advice on this. Every time I instantiate a new class within QT I will get linker errors without fail even I it is correctly instantiated. Now if I close the project and copy and paste everything into a fresh project, the linker error is gone and it works as it should. I have to copy and paste everything into a new project every time I want to do this. Any thoughts on how to fix this?

    -Thanks

    M 1 Reply Last reply
    0
    • M Machsanity

      Hey all,

      I'm getting very frustrated with QT and I would like some advice on this. Every time I instantiate a new class within QT I will get linker errors without fail even I it is correctly instantiated. Now if I close the project and copy and paste everything into a fresh project, the linker error is gone and it works as it should. I have to copy and paste everything into a new project every time I want to do this. Any thoughts on how to fix this?

      -Thanks

      M Offline
      M Offline
      Machsanity
      wrote on last edited by
      #2

      To be more specific the error is a LNK2019

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        You don't give enough information: what exact class are you using that gets you this error ? Did you check what module it's in ? Did you add the module to your pro file ?

        e.g. using QSqlDatabase requires the sql module so your have to add QT += sql to your pro file and re-run qmake before you can use them

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        M 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          You don't give enough information: what exact class are you using that gets you this error ? Did you check what module it's in ? Did you add the module to your pro file ?

          e.g. using QSqlDatabase requires the sql module so your have to add QT += sql to your pro file and re-run qmake before you can use them

          M Offline
          M Offline
          Machsanity
          wrote on last edited by Machsanity
          #4

          @SGaist

          For example:

          class A{
          //constructor and functions here
          }

          class B{
          // a.h included here
          A *name = new A();

          }

          every time that format will throw a linker error. Say both of those are my own custom classes.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Do I read right that you are including a header inside a class definition ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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