Qt error: LNK1181: cannot open input file 'debug\main.obj'

前端 未结 8 1632
小蘑菇
小蘑菇 2021-01-02 02:39

Qt creator was working well, but suddenly shows a problem error: LNK1181: cannot open input file \'debug\\main.obj\'.
This problem shows always with any typ

相关标签:
8条回答
  • 2021-01-02 03:17

    Okay, we finally have a real answer for this generalized problem instead of the OP's typo problem if that didn't unblock you either.

    Actual Problem (black-box perspective): The "Build directory" auto-filled entry breaks for projects inside whitespace directories. Qt Creator actually prohibits you and tells you not to use whitespace when making new Projects. You can still close a new project and re-name it to add whitespace, and Qt Creator will handle it gracefully. If you copy the build directory, even with whitespace in it, and paste that into the field replacing the broken auto-generated path (mine was using relative paths) then JOM will start working correctly, as QMake does not generate any errors. I can't speak for other Make tools.

    1. Make or clone down your project with whitespace
    2. Load it in Qt Creator
    3. Run QMAKE
    4. Select the "Project" button on the left-hand side
    5. Make sure you're in the "Build" tab
    6. Select "Browse", and then re-select the shadow directory QMAKE made

    That should unblock you if it wasn't a simple issue for deleting the old QMAKE-generated folders, which is the most common problem people face with this specific error while developing within Qt Creator.

    0 讨论(0)
  • 2021-01-02 03:20

    This problem occurs also if you have in the .pro or .pri files something like:

    HEADERS += \ \

    or

    SOURCES += \ \

    0 讨论(0)
  • 2021-01-02 03:28

    I got the error because of this:

    HEADERS += \ \
        $$PWD/QOakTreeViewRecursiveModel.h
    

    instead of:

    HEADERS += \
        $$PWD/QOakTreeViewRecursiveModel.h
    
    0 讨论(0)
  • 2021-01-02 03:35

    hmm If I remember correctly when I faced this kind of problems using your similar setup (QtCreator and Windows) running QMAKE & rebuilding the project again helped me solve this linker errors.

    0 讨论(0)
  • 2021-01-02 03:36

    Run Clean and qMake and rebuild.
    I has like this problem and this helped me.

    0 讨论(0)
  • 2021-01-02 03:39

    This problem also occurs if the path of your project (name of any folder) contains a white space.

    0 讨论(0)
提交回复
热议问题