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

Author Topic: [SOLVED] Understanding how to target architectures  (Read 6937 times)

0 Members and 1 Guest are viewing this topic.

farwater

  • Newbie
  • *
  • Posts: 6
    • View Profile
[SOLVED] Understanding how to target architectures
« on: March 13, 2015, 07:04:44 pm »
Hi all,

It's my first attempt to use SFML, seems very powerful to me, however, when I tried to compile some examples, I receibed a (classic) "bad image exception".
I take a look here and there, and most of answers to this problem are like "use 64 bits dll to compile for 64 bits sistems, and 32 for 32 bits sistems".

Ok, simple. But not so simple... the fact is that when I compile using 32 bits dll targeting 32 bits architecture, I receibe a bad image exception, (I expected no problems at all, most 32 bits software runs just fine in any 64 windows sistem) the only way to makes it run is... using 32 bits dlls but targeting 64 bits sistem, and at least it runs on a windows 8.1 64 bits. Or in other words: wtf?


My setting:
SFML 2.2
Visual studio 2013
Windows 8.1 64 bits.

What am I missing? Any ideas?

Oh, one more weird thing:
First I tried to compile from a machine with windows xp 32 bits and Visual Studio 2010 and it was impossible, neither targeting 32 or 64 bits.

Thanks in advance and excuse my english, it's not my first language.
« Last Edit: March 14, 2015, 05:30:10 pm by farwater »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
AW: understanding how to target architectures
« Reply #1 on: March 13, 2015, 07:11:53 pm »
Provide the full error message.
Provide the verbose build command: http://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/

farwater

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: understanding how to target architectures
« Reply #2 on: March 13, 2015, 08:37:36 pm »
Excuse me, at least using Visual Studio 2013 and windows 8.1, it compiles, but when I tried to do anything with SFML, it throws this exeption:

A first chance exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll

Additional information: Could not load file or assembly 'sfmlnet-audio-2, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
An attempt was made to load a program with an incorrect format.

P.S:  The only way I can run examples without errors is targeting x64 (using 32 bits dlls), and I'm wondering, if I compile targeting x64, will it run on an x86 sistem?

« Last Edit: March 13, 2015, 08:51:32 pm by farwater »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: understanding how to target architectures
« Reply #3 on: March 13, 2015, 08:44:37 pm »
And you never thought that it would be a good idea to tell us that you're using SFML.Net? ::)
Laurent Gomila - SFML developer

farwater

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: understanding how to target architectures
« Reply #4 on: March 13, 2015, 09:01:18 pm »

Hi, Laurent:

Sorry, I suposed saying that I used both Visual studio 2010 and Visual studio 2013 was enought.

It's what you discused here:
http://en.sfml-dev.org/forums/index.php?topic=11733.0

But I still don't understand...

Ah, good job, it's the best libary I've seen for those purposes. Lol, and I posted to the wrong place... Great start.
« Last Edit: March 13, 2015, 09:05:41 pm by farwater »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
AW: understanding how to target architectures
« Reply #5 on: March 13, 2015, 09:34:48 pm »
You can equally well use VS for C++ development.

Where did you get DLLs from? Do you have the CSFML and SFML.Net libraries?

Btw. it's called "system" not "sistem". ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: understanding how to target architectures
« Reply #6 on: March 13, 2015, 09:48:59 pm »
Don't compile your project with 'All CPU' - instead make sure you pick 'x86' or 'x64' and that it matches the SFML.NET and CSFML version.

Everything must be either x86 or x64 or you will have issues.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

farwater

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: understanding how to target architectures
« Reply #7 on: March 13, 2015, 09:58:03 pm »
Certainly...

eXpl0it3r, I get them from official page:
http://www.sfml-dev.org/download/sfml.net/
Tagged as: All compilers - 32-bit.

Yea, system, not sistem. In my computer messages apear in spanish, so I translated manually and mistyped :)

farwater

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: understanding how to target architectures
« Reply #8 on: March 14, 2015, 09:27:35 am »
Thanks, zsbzsb, but my question remains:
Why does my application run only when I target x64, using 32bit dlls? Is it cause I'm runing windows 64 bits?  And, when I compile targeting x86, with 32bit dlls I get this warning:
Warning   2   There was a mismatch between the processor architecture of the project being built "x86" and the processor architecture of the reference "sfmlnet-graphics-2, Version=2.1.0.0, Culture=neutral, processorArchitecture=x86", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.   sfml

So I supose my app will not run on a 32 bits sistem... No idea what I'm doing wrong, cause I use 32 bits dlls targeting x86, it makes sense to me.... :)

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: understanding how to target architectures
« Reply #9 on: March 14, 2015, 01:19:51 pm »
Well it seems as if there was a mistake with the SFML.NET 2.2 32 bit package. I just tested and it seems to have gotten 64 bit dlls somehow. :P So I am going to reupload it to fix it. So thanks for the report  8)

Once you get the new package you should be able to target x86 (32 bit) without any issues.

And until I get eXpl0it3r to fix it on the main site, here is a download link.
« Last Edit: March 14, 2015, 01:21:42 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

farwater

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: understanding how to target architectures
« Reply #10 on: March 14, 2015, 03:28:05 pm »
Wow, now it works just fine.
Thanks so much for your help.