Results 1 to 5 of 5

Thread: LNK1181 cannot open input file 'obj\filename.obj'

  1. #1
    Join Date
    May 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Question LNK1181 cannot open input file 'obj\filename.obj'

    Hi,

    I know this problem isn't uncommon, but all the other solutions didn't work for me.
    As I'm new to Qt I'm probably overlooking something simple.

    I want to access OpenStreetMap data with the Qt Widget QMapControl.
    I downloaded the most recent version from: https://sourceforge.net/projects/qmapcontrol/

    Now, in this package there is a directory "samples", but I can't get to run any of them.
    I open the .pro file of one and already tried repeatedly (re-)building, qmaking and cleaning up the project.

    But the error message is always some variation of "error: LNK1181: cannot open input file 'obj\filename.obj'".
    Also, in the build\obj folder, the file is not present, only "moc_filename.obj"

    I'm using Qt 5.6.0 MSVC2015 64bit and Windows 10, so I'm wondering if it might be related to that?

    Regards

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,854
    Thanks
    271
    Thanked 788 Times in 778 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: LNK1181 cannot open input file 'obj\filename.obj'

    I did this:

    1 - Downloaded and unzipped QMapControl
    2 - Started MSVC 2013 and used the Qt addin for Visual Studio to open the top level .pro file
    3 - This creates an MSVC solution file (.sln) and project files (.vcxproj) for the control DLL and sample programs.
    4 - Set Citymap as the startup project, clicked "build". Compiled and linked without errors.
    5 - Ran it. Worked fine.

    I also did this:

    1 - Opened a Visual Studio 2013 command prompt window
    2 - Went to the QMapControl top level directory
    3 - Typed "qmake". This generated the Makefiles for the top level (QMapControl.pro) and Samples directories
    4 - Typed "nmake -f Makefile". This compiled and linked the DLL and sample .exe files into the Samples\bin subdirectory
    5 - Went into that directory, typed "Citymap" to run it. Ran fine.

    Possibly you didn't try to build in an MSVC command prompt window. This is a must, because it sets up the path to point to the right compiler and linker. You also must use nmake instead of make.

    That I used MSVC 2013 is irrelevant. I also could have done this with MSVC 2008 or 2015, which I also have installed. So is the fact that my default Qt is 5.4 (even though I have 5.5 and 5.6 installed). It just what I get when I open Visual Studio or the command prompt.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    May 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: LNK1181 cannot open input file 'obj\filename.obj'

    Hi and thanks for your reply.
    I tried both of your ways, but it still didn't work.

    For the first one:
    I couldn't install the Qt5 Add-In, with the following error message:
    "The installer could not find an installation of Visual Studio 200x.
    Please note that Visual C++ Express is not supported."

    As I'm using only the Community Version of VS2015, that might be the reason.

    Thus, I installed the Qt5Package via "Tools -> Extensions and Updates".
    In the new tab "QT5->Qt Options" I added a Qt Version with path "C:\Qt\5.6\msvc2015_64".
    Now, I opened the top level .pro file of QMapControl. ("Samples.pro")
    This worked, VS creates its own .sln file and all .vcxproj files in the subdirectories.
    But building the solution I get the following error for every project:
    Error LNK1104 cannot open file 'qmapcontrol0.lib' Citymap PathToQMapControl\QMapControl 0.9.7.9\QMapControl\Samples\Citymap\LINK 1
    I also couldn't find this qmapcontrol0.lib file, where should it normally be created?

    Then I tried your second approach.
    I assume you meant "Developer Command Prompt for VS20xx" which I can find in the startmenu, right?
    I navigated to "...\QMapControl 0.9.7.9\QMapControl" and ran qmake which worked after I added "C:\Qt\5.6\msvc2015_64\bin" to the system path.
    But "nmake -f Makefile" finished with errors:
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /VERSION:0.9 /MANIFEST:embed /OUT:..\Samples\bin\qmapcontrol0.dll @C:\Users\MyUsername\AppData\Local\Temp\nm101E.tmp
    Qt5Widgets.lib(Qt5Widgets.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x458'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.

    If I understand this correctly, there seems to be a problem with 32bit and 64bit versions, yes?
    Do I have to specify for nmake that I want to target 64bit?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,854
    Thanks
    271
    Thanked 788 Times in 778 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: LNK1181 cannot open input file 'obj\filename.obj'

    Error LNK1104 cannot open file 'qmapcontrol0.lib' Citymap PathToQMapControl\QMapControl 0.9.7.9\QMapControl\Samples\Citymap\LINK 1
    Because you built your solution from Samples.pro, not QMapControl.pro, one directory level higher. Samples is not the top-level directory when you unzip the distribution file, QMapControl is. Try again using QMapControl.pro as input to VS. Starting there also adds the Samples projects and sets them to be dependent on QMapControl0.lib/dll, so these will be built too.

    Do I have to specify for nmake that I want to target 64bit?
    It looks like you opened a 32-bit Developer Command Prompt window. If you have only a 64-bit Qt installed, this won't work. There should be a corresponding 64-bit Developer Command Prompt option on your menu. Use that.

    Edit...

    On my MSVC 2015 install, there is a submenu for "Windows Desktop Command Prompts". Use the "VS2015 x64 Native Tools Command Prompt" from that. If you don't see it, make yourself a .bat file and put this line in it:

    Qt Code:
    1. %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" amd64
    To copy to clipboard, switch view to plain text mode 

    (Change the path to point to where you have MSVC installed if that isn't correct). Put a shortcut to this .bat file on your desktop and you should be able to double-click it to launch the developer window.
    Last edited by d_stranz; 18th May 2016 at 18:29.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. The following user says thank you to d_stranz for this useful post:

    HappenedTomatoes (19th May 2016)

  6. #5
    Join Date
    May 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: LNK1181 cannot open input file 'obj\filename.obj'

    Thank you so much, building QMapControl.pro finally worked!

Similar Threads

  1. Replies: 1
    Last Post: 16th February 2016, 17:56
  2. Replies: 1
    Last Post: 6th December 2009, 15:28
  3. Replies: 7
    Last Post: 18th September 2009, 15:44
  4. Replies: 1
    Last Post: 27th March 2009, 07:22
  5. Replies: 4
    Last Post: 24th November 2007, 14:33

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.