Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [FIXED]Problem with static linking - missing winmm.lib  (Read 11046 times)

0 Members and 2 Guests are viewing this topic.

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
[FIXED]Problem with static linking - missing winmm.lib
« on: January 24, 2018, 06:30:51 am »
I have downloaded  SFML 2.4.2 for Visual C++ 14 (2015) - 32-bit, and I am trying to run the program on x86. More specifically SFML-2.4.2-windows-vc14-32-bit (as the zip file is currently named).

I am having issues with setting SFML up, and I am currently receiving a single error.

The error I have:

ERROR: LNK1104   cannot open file 'winmm.lib'

PROJECT PROPERTIES

Additional Library Directiories:
C:\SFML\lib;%(AdditionalLibraryDirectories)

Additional Include Libraries: C:\SFML\include;%(AdditionalIncludeDirectories)

Preprocessor Defition: SFML_STATIC;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)


ADDITIONAL DEPENDENCIES
RELEASE:
sfml-graphics-s.lib
sfml-window-s.lib
sfml-system-s.lib
freetype.lib
jpeg.lib
opengl32.lib
winmm.lib

DEBUG:

sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-system-s-d.lib
freetype.lib
jpeg.lib
opengl32.lib
winmm.lib


Other relavent details:
Currently using the latest version of Visual Studio 2017 (reinstalled again as of 5:00AM, 24/01/2018 GMT+0)

It worked when I pasted it into a template win32 application but the auto-generated code was practically impossible to remove without breaking the program, AND I assume there must be a way to do it from an empty project, I am just probably missing something.

Code:

#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();
                window.draw(shape);
                window.display();
        }

        return 0;
}



« Last Edit: January 25, 2018, 12:05:08 am by Mantas »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Problem with static linking - missing winmm.lib
« Reply #1 on: January 24, 2018, 07:31:55 am »
Sounds like you deleted some of the pre-defined lib directory. Try setting up a new project.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #2 on: January 24, 2018, 05:47:56 pm »
I have tried setting up a new project, I even completely reinstalled VS2017. I have followed the tutorial to the pixel and I keep getting the same result.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Problem with static linking - missing winmm.lib
« Reply #3 on: January 24, 2018, 06:12:00 pm »
What Windows SDK do you have installed?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #4 on: January 24, 2018, 06:36:26 pm »
QFE Build: 10.0.16299.91 - Released November 2017

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Problem with static linking - missing winmm.lib
« Reply #5 on: January 24, 2018, 06:57:05 pm »
There should be a WinMM.Lib file in (by default) C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.91\um\$(ARCH). Is this correct?

For reference, I have 10.0.16299.0 installed, and that is where it is located on my machine.

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #6 on: January 24, 2018, 07:05:33 pm »
There should be a WinMM.Lib file in (by default) C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.91\um\$(ARCH). Is this correct?

For reference, I have 10.0.16299.0 installed, and that is where it is located on my machine.

It is the exact same on my machine.

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #7 on: January 24, 2018, 09:24:31 pm »
Update: I have re-installed windows entirely, the problem still persists.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Problem with static linking - missing winmm.lib
« Reply #8 on: January 24, 2018, 09:30:03 pm »
What's your verbose build output: https://www.sfml-dev.org/faq.php#tr-grl-verbose-ide

What if you provide the absolute path to the lib directly when listing it?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #9 on: January 24, 2018, 09:50:20 pm »
What's your verbose build output: https://www.sfml-dev.org/faq.php#tr-grl-verbose-ide

1>------ Build started: Project: Fireworks, Configuration: Debug Win32 ------
1>Microsoft (R) Incremental Linker Version 14.12.25834.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>
1>"/OUT:C:\Users\Mantas\Documents\VS Projects\Fireworks\Debug\Fireworks.exe" /INCREMENTAL "/LIBPATH:C:\SFML-2.4.2\lib" "sfml-graphics-s-d.lib" "sfml-window-s-d.lib" "sfml-system-s-d.lib" freetype.lib jpeg.lib opengl32.lib "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x86\WinMM.lib&#65279;" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK "/PDB:C:\Users\Mantas\Documents\VS Projects\Fireworks\Debug\Fireworks.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\Mantas\Documents\VS Projects\Fireworks\Debug\Fireworks.lib" /MACHINE:X86 Debug\main.obj
1>LINK : fatal error LNK1104: cannot open file 'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x86\WinMM.lib&#65279;'
1>Done building project "Fireworks.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


What if you provide the absolute path to the lib directly when listing it?

Error   LNK1104   cannot open file 'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x86\WinMM.lib'   



eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Problem with static linking - missing winmm.lib
« Reply #10 on: January 24, 2018, 11:42:10 pm »
Code: [Select]
winMM.lib&#65279;
From were ever you copy pasted it, you seem to have added a &#65279; (ZERO WIDTH NO-BREAK SPACE) character making it fail to find it. Make sure you don't have any empty line or other weird entries in there.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #11 on: January 25, 2018, 12:00:44 am »
Code: [Select]
winMM.lib&#65279;
From were ever you copy pasted it, you seem to have added a &#65279; (ZERO WIDTH NO-BREAK SPACE) character making it fail to find it. Make sure you don't have any empty line or other weird entries in there.

So I changed it, just to be sure, now I get this EVEN if I revert it back to simply "winmm.lib" without the full directory.


1>------ Build started: Project: Fireworks, Configuration: Debug Win32 ------
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>C:\Users\Mantas\Documents\VS Projects\Fireworks\Debug\Fireworks.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "Fireworks.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Problem with static linking - missing winmm.lib
« Reply #12 on: January 25, 2018, 12:02:45 am »
That's a different error though. Since you changed the subsystem to windows you need to link against sfml-main.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mantas

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problem with static linking - missing winmm.lib
« Reply #13 on: January 25, 2018, 12:04:52 am »
JESUS FUCKING CHRIST THANK YOU.

I have no idea why that was set from the default EVEN after 2 VS resets and a full OS reinstall. That fixed it, changing the Subsystem to "not set" fixed everything.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: [FIXED]Problem with static linking - missing winmm.lib
« Reply #14 on: January 25, 2018, 12:54:17 am »
Well there were two issues. First one was you having some weird character copy pasted from somewhere, causing winmm to not be found and the second one was the subsystem.

If you don't roughly understand what the verbose output says, I recommend you brush up on your compiler/linker knowledge. This is essential stuff and it will help you fix a lot of potential compiler/linker issues. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything