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

Author Topic: SFML Visual Studio 2022 Initial Configuration error  (Read 2384 times)

0 Members and 1 Guest are viewing this topic.

robotshark

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML Visual Studio 2022 Initial Configuration error
« on: July 08, 2024, 05:56:43 am »
Hello,

I'm using visual studio 2022 and I've pulled both the "Visual C++ 17 (2022) - 32-bit" and "Visual C++ 17 (2022) - 64-bit" files.

I've followed the instructions and changed the C/C++ -> General -> Additional include directories to the path the include files are stored (Using All configuration and 64 bit and All configuration 32 bit).

I've also changed the linker, Linker -> General -> Additional library directories to the path that has the library files (Using All configuration and 64 bit and All configuration 32 bit).

I've also changed input to list the dll files: sfml-window-d.dll;sfml-graphics-d.dll;sfml-system-d.dll;sfml-audio-d.dll;sfml-network-d.dll; for both debug (the one listed) and the other files as release for both 64 bit and 32 bit.  The files I listed is what I have Visual Studio set to now, but this was after initially putting them listed as "sfml-system-d-2.dll", as this is what the file name is actually called.  The tutorial shows the file name as "sfml-window-d.dll" but I've tried both naming conventions and neither work.

Either way, neither work.  The error I receive from Visual Studio is Link 1107: invalid or corrupt file: cannot read at 0x300 with file sfml-window-d.dll.  I've also downloaded these files multiple times with the same outcome. This file has been the "window" file, "system" file mostly and I've gone through the process of completely removing Visual Studio before trying again with the same result multiple times.  (FYI, no issues getting the SFML file to work and compile in Linux).

Any help would be appreciated!

Thanks,

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10988
    • View Profile
    • development blog
    • Email
Re: SFML Visual Studio 2022 Initial Configuration error
« Reply #1 on: July 08, 2024, 07:39:36 am »
I've also changed input to list the dll files: sfml-window-d.dll;sfml-graphics-d.dll;sfml-system-d.dll;sfml-audio-d.dll;sfml-network-d.dll; for both debug (the one listed) and the other files as release for both 64 bit and 32 bit.  The files I listed is what I have Visual Studio set to now, but this was after initially putting them listed as "sfml-system-d-2.dll", as this is what the file name is actually called.  The tutorial shows the file name as "sfml-window-d.dll" but I've tried both naming conventions and neither work.

Either way, neither work.  The error I receive from Visual Studio is Link 1107: invalid or corrupt file: cannot read at 0x300 with file sfml-window-d.dll.  I've also downloaded these files multiple times with the same outcome. This file has been the "window" file, "system" file mostly and I've gone through the process of completely removing Visual Studio before trying again with the same result multiple times.
You need to list the *.lib files (aka import libraries), not the *.dll files (aka shared libraries).

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

robotshark

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML Visual Studio 2022 Initial Configuration error
« Reply #2 on: July 09, 2024, 01:29:36 am »
Yep, sorry about that.  When I wrote down all the steps I took, I accidentally put .dll.   After your post, I double checked.  I also re-did the steps in the tutorial again and same error. I've posted screenshot here.


robotshark

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML Visual Studio 2022 Initial Configuration error
« Reply #3 on: July 09, 2024, 01:36:24 am »
To clarify, that was my fault after configuring Visual Studio 20 times. Must have gotten tired and didn't catch the incorrect filetype that you pointed out (thanks for that also, btw!).  The original error, and the reason for so many tries, was the screenshot I posted with LNK1104 error.

Thanks for your help.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10988
    • View Profile
    • development blog
    • Email
Re: SFML Visual Studio 2022 Initial Configuration error
« Reply #4 on: July 09, 2024, 08:18:09 am »
If it can't find the *.lib file, then the path to the libs aren't set correctly, or are in a directory with permissions set that VS doesn't have.

If you can't figure it out, post the verbose build output, so we see the exact commands utilized by VS: https://www.sfml-dev.org/faq.php#tr-grl-verbose-ide
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

robotshark

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML Visual Studio 2022 Initial Configuration error
« Reply #5 on: July 09, 2024, 06:00:13 pm »
I found the solution to my problem, and I'll list it here for anyone else who gets this error.

Instead of listing the additional dependencies "sfml-window-d.lib" as instructed, I listed the full file path to where the library file was located.  I removed the quotes windows adds when you use the right click command "copy as path".  I did this for all the library's I was using in my project.

For example: instead of sfml-window-d.lib, I put C:\SFML\lib\sfml-window-d.lib. So sfml-system-d.lib would be C:\SFML\lib\sfml-system-d.lib, and sfml-graphics-d.lib would be C:\SFML\lib\sfml-graphics-d.lib, etc.,

Thanks for your help eXpl0it3r!