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

Author Topic: [SOLVED] Can't release 64x builds.  (Read 2530 times)

0 Members and 1 Guest are viewing this topic.

Riser

  • Newbie
  • *
  • Posts: 33
    • View Profile
[SOLVED] Can't release 64x builds.
« on: January 22, 2022, 01:15:41 am »
Hey, it's been a while, since I've been using SFML casually this whole time, I didn't really bother with project configurations, and as such I've been working with 32-bit apps this whole time, but when I recently tried switching to 64-bit, I got a "cannot open source file" error for all SFML headers.





Any idea what that's about?

« Last Edit: January 23, 2022, 02:50:49 pm by Riser »

kojack

  • Sr. Member
  • ****
  • Posts: 300
  • C++/C# game dev teacher.
    • View Profile
Re: Can't release 64x builds.
« Reply #1 on: January 22, 2022, 03:10:37 am »
32 and 64 bit build types have separate settings.
In the project properties panel, you can use the Platform list at the top to choose which one you are looking at. Make sure the 64 bit version has the same settings (like include directory) as the 32 bit one.

Riser

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Can't release 64x builds.
« Reply #2 on: January 22, 2022, 02:28:03 pm »
Well, after struggling with this for a bit I thought maybe I should re-install the library from scratch and make sure I set the same configurations to all platforms from the beginning and see if that fixes the problem, but on the download page it says it's recommended that you compile for 32-bit machines to reach the biggest possible audience, since a 64-bit machine can perfectly run a 32-bit app, so I guess I don't have to do any of this after all, should've done my research instead of assuming compiling to 64-bit would have some hidden benefit.

Well, thanks either way, hope this helps someone else in the future.

kojack

  • Sr. Member
  • ****
  • Posts: 300
  • C++/C# game dev teacher.
    • View Profile
Re: Can't release 64x builds.
« Reply #3 on: January 22, 2022, 03:57:14 pm »
Compiling to 64 bit has a very big advantage: access to more memory.

On Windows, a standard 32bit program can only access 2GB of ram. If you enable the Large Address Aware flag (either when compiling, or manually setting it on the executable later) then you get around 3.5GB of ram of the potential 4GB address space.
But a 64bit program gets potential access to all free system ram.

64 bit programs can also potentially run faster, due to having more registers available and only a single calling convention using registers.

If Visual Studio is saying an include can't be found, that means the include search path isn't correct. Changing the Additional Include Directories setting for 64 bit platforms to the same as on 32 bit platforms should be enough to fix it.

But if you don't need the memory, 32bit would be wider supported (very slightly on Steam, where 99.73% of users are 64 bit according to the last hardware survey, but probably more elsewhere).

Riser

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Can't release 64x builds.
« Reply #4 on: January 23, 2022, 10:39:37 am »
I did specify the include paths for 64-bit but it wasn't enough, I'm guessing it's a linking issue, I'm planning on re-installing SFML and creating a new template from scratch that will allow me to compile for both 64 and 32 bit, I'm a bit confused as to which version of the library (32-bit or 64-bit) I'd want to download though, which one will allow me the option to compile for both platforms?

Sorry if this is an amateur question, I tend to focus on the process of coding itself so I often neglect learning about things like this.

kojack

  • Sr. Member
  • ****
  • Posts: 300
  • C++/C# game dev teacher.
    • View Profile
Re: Can't release 64x builds.
« Reply #5 on: January 23, 2022, 11:18:40 am »
32 bit and 64 bit components (programs, libraries) are incompatible, they use different calling conventions. A 32 bit program requires all parts to be 32 bit. Same for 64 bit, all parts must be 64 bit.
If you want to support both, you need both versions of SFML and choose which to use based on the current platform in Visual Studio.

64 bit Windows can run 32 bit and 64 bit programs, but it runs 32 bit using a compatibility layer called WOW64 (Windows 32 On Windows 64). https://en.wikipedia.org/wiki/WoW64

Riser

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Can't release 64x builds.
« Reply #6 on: January 23, 2022, 02:50:25 pm »
Alright then, I already have the 32-bit template ready which is what I've been working with, so I'll make a 64-bit one if I end up needing it, thank you so much, this was extremly informative and helpful.