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

Author Topic: Setting up Visual Studio 2008  (Read 7947 times)

0 Members and 1 Guest are viewing this topic.

Darwin226

  • Newbie
  • *
  • Posts: 3
    • View Profile
Setting up Visual Studio 2008
« on: April 07, 2010, 02:01:22 am »
So, I created a new project (console application) added the files in lib directory to the references and added the files in the extlibs directory next to my exe. Now I get this error

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Help please :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Setting up Visual Studio 2008
« Reply #1 on: April 07, 2010, 08:27:25 am »
Which version of SFML do you use?

Do you compile for 32 or 64 bits?
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Setting up Visual Studio 2008
« Reply #2 on: April 07, 2010, 09:02:26 am »
If you are on 64-bit Windows, you will have to recompile. Easiest thing to do is just rebuild the SFML .NET bindings, and your program you are using SFML in, as x86 instead of Any CPU. This way you can bypass recompiling SFML itself for the time being.

Xeon06

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Setting up Visual Studio 2008
« Reply #3 on: April 09, 2010, 11:20:09 pm »
Target x86 when building.

This is the most common problem I see with beginners of SFML.Net. Maybe this should be stickied or something.

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Setting up Visual Studio 2008
« Reply #4 on: April 10, 2010, 01:25:02 am »
Or maybe it the .NET bindings should be x86 by default. I don't see why Any CPU should be used for the samples when the sample build doesn't support x64.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Setting up Visual Studio 2008
« Reply #5 on: April 10, 2010, 10:46:12 am »
Quote from: "Spodi"
Or maybe it the .NET bindings should be x86 by default. I don't see why Any CPU should be used for the samples when the sample build doesn't support x64.

I'm not a .Net expert, the only reason why it is "Any CPU" is because it is the default option :)
If switching to "x86" is really better I'll change it.
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Setting up Visual Studio 2008
« Reply #6 on: April 10, 2010, 10:14:55 pm »
Fair enough. Most people will just use Any CPU, too, until something breaks. After all, it is the best of all the options. :)

With Any CPU selected, .NET will use x86-64 if its a 64-bit OS. Otherwise, it will use x86. So anyone with a 32-bit OS won't be noticing this error when using the .NET bindings. When a user with a 64-bit OS runs the program, the .NET framework will end up looking the 64-bit version of the CSFML libraries. And this is why people get InvalidImageFormatException or whatever it is - since the program is trying to load a 32-bit library as 64-bit.

So yes, please use x86. :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Setting up Visual Studio 2008
« Reply #7 on: April 11, 2010, 09:56:57 am »
Ok ;)
Laurent Gomila - SFML developer

messiaen

  • Newbie
  • *
  • Posts: 1
    • View Profile
Setting up Visual Studio 2008
« Reply #8 on: February 12, 2011, 04:48:41 am »
Sorry for bumping this old thread, however I came across SFML.net and I ran into the same problem described in this thread. I am using Visual Studio C# Express 2008, but the problem is that I can't compile from the source targetting x86 because that feature isn't available in the express version.

Would anyone be kind to provide the x86-targetted .dll files or some alternative so I can overcome this and start learning SFML (it looks great!)?

edit: I use a x64 Windows 7 system.

Brendon

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Setting up Visual Studio 2008
« Reply #9 on: February 12, 2011, 06:35:00 pm »
I'm using Visual Studio C# 2008 Express and the downloaded sfml libraries seem to work for me.

In the dropdown box labeled "Any CPU", go to:
Configuration Manager > Active Solution Platform > Type or select new platform > x86