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. How to troubelshoot collect2: error: ?

How to troubelshoot collect2: error: ?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 443 Views 2 Watching
  • 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
    Anonymous_Banned275
    wrote on last edited by
    #1

    "on line help" indicates this MAY be repose to previous errors.
    I run "clean" and "rebuidl" and still getting this AND ONLY this error.
    It started after I added "existing files" - none of them are currenlty used during buidl.

    :-1: error: collect2: error: ld returned 1 exit status

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

      Because using the same file name twice in the same build scope will generate duplicated commands as the warning you had suggests. Your "empty" main was the last one and thus used and since it was not containing any code, there were missing bits.

      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
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        You need to provide the lines previous to this one. There's not enough information to diagnose what is happening.

        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
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #3

          Thanks for reply.
          This is the only real error I get.

          I am getting tons of warnings , but my app runs as expected ( when I have no errors ) warnings do not bother me right now.

          PS.
          Is there a way to capture / print all "issues" as text ?
          (QtCreator)

          888801d3-2c39-4760-bfd3-081920b96f49-image.png

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anonymous_Banned275
            wrote on last edited by Anonymous_Banned275
            #4

            I did "back-up" to my previous project version and now I am getting only this:

            0beac568-ab1b-40d8-a382-cb3158053357-image.png

            I did add some existing files - including another main.cpp, BUT I have bypassed both main.cpp and main .h.

            My next attempt to resolve will be to physically delete the extra main files.

            SOLVED
            Deleting the extra main.cpp solved the issue .
            Still not sure why simply bypassing the entire file contents ( #ifdef BYPASS ...#endif) created the problem .

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

              Because using the same file name twice in the same build scope will generate duplicated commands as the warning you had suggests. Your "empty" main was the last one and thus used and since it was not containing any code, there were missing bits.

              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
              1
              • A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by
                #6

                True, however, I did same (#ifdef BYPASS... #endif) for other files and received unclassified ( no error nor warning) message saying effectively the "class" could no be build. Since "main" is not a class it makes sense.
                I'll shall try same stunt in plain C++ when I am done with Qt, however in IDE I can selectively bypass / not compile any file.
                It would be nice and cleaner to do such in QCreator.
                On the other hand - how many developers import a file and not use it?

                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