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

Author Topic: Question on window tutorial  (Read 13129 times)

0 Members and 1 Guest are viewing this topic.

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« on: January 21, 2010, 08:15:06 pm »
Hello,

I'm new to SFML and also quite new to C++ in general, so I tried the official tutorials as a start.
However I'm now stuck at the tutorial on creating windows. I compiles fine (using MSVC++ 2010 beta2 and the code included in the tutorial), but when I start the application I get the following message:
"Unhandled exception at 0x75f19f11 in SFML Window.exe: 0xC0000005: Access violation reading location 0x6e695720."

When I start the exe directly from the Windows Explorer it simply says that the exe doesn't work anylonger.
I'm using Windows 7, by the way.

Do I need Qt or wxWidgets to succesfully run this program? Do you have any idea what I'm doing wrong?

Thanks,
bnz

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Question on window tutorial
« Reply #1 on: January 21, 2010, 08:59:32 pm »
Have you linked the correct Libs? (-d for Debug)...

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #2 on: January 21, 2010, 09:20:35 pm »
Yes, at least I think so.
Here are two screenshots of the properties:

In the folder, where the executable is located, I added the sfml-window-d.dll and the sfml-system-d.dll.

bnz

Flawe

  • Newbie
  • *
  • Posts: 24
    • View Profile
Question on window tutorial
« Reply #3 on: January 21, 2010, 11:46:28 pm »
You're linking only to window and main, not system. Add sfml-system-d.lib to the list.

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #4 on: January 22, 2010, 10:03:23 am »
Unfortunately that didn't change anything.
The exeption is thrown at the following line:
Code: [Select]
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

By the way: Why did I have to link to smfl-system-d? Wouldn't the compiler complain if something was missing?

bnz

EDIT: Just for the fun of it, I tried to link to the non-debug versions of the librarys and after copying the needed dlls into the executable's folder it worked.
I hope this gives you some clues, why it is not working with the debug versions.

bnz

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question on window tutorial
« Reply #5 on: January 22, 2010, 10:12:49 am »
You should recompile SFML with your Visual Studio 2010. VS versions are highly incompatible, and the SFML SDK only provides precompiled binaries for VS 2005 and 2008.
Laurent Gomila - SFML developer

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #6 on: January 22, 2010, 10:16:35 am »
Oh, okay.
I will try that this evening.

Thanks,
bnz

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #7 on: January 22, 2010, 06:40:54 pm »
Well, I just tried to build SFML with Visual Studio 2010 beta2 and I'm quite lost. =)
Following the tutorial does not really work or at least I'm not doing it right.
When I open the SFML.sln, the "Visual Studio Conversion Wizard" starts and wants to convert the project. When I then select the whole solution, containing 18 projects, and select "Build" it does something, but I actually have no clue what it does or how I could manipulate it.
It also seems strange that the projects contains sub-projects like "pong" or "wxwdgets".

Well, as you see I am a little confused and it would be great, if you could give me a pointer on how to compile SFML correctly, so that I have all needed files (all .dll and .lib files with all the different endings) at the end.

Thanks,
bnz

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question on window tutorial
« Reply #8 on: January 22, 2010, 09:59:59 pm »
Quote
When I then select the whole solution, containing 18 projects, and select "Build" it does something, but I actually have no clue what it does or how I could manipulate it

Do you have the "output" tab opened? What messages does it show?

Quote
It also seems strange that the projects contains sub-projects like "pong" or "wxwdgets".

It's not sub-projects, I just put them in virtual folders to separate between SFML libraries and example applications.

Quote
Well, as you see I am a little confused and it would be great, if you could give me a pointer on how to compile SFML correctly, so that I have all needed files (all .dll and .lib files with all the different endings) at the end.

It should really not be harder than clicking on "build" (after selecting the configuration that you want to build) ;)
Laurent Gomila - SFML developer

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #9 on: January 22, 2010, 10:45:09 pm »
I think now I got it! Well, almost.

The problem was, that I did not exactly know where to look for the files, now I realized that they are directly created in the correct folder. =)

So in the end it was really not harder than "clicking on "build"", as you said. ;)

Now to the reason I said "almost":
When compiling the Release DLLs it says:
Rebuild All: 1 succeeded, 5 failed, 12 skipped

But all files are there. Could that be a problem?

bnz

EDIT:
Still one problem: How can I create the "sfml-xxx-d.lib" files? I only can choose between Debug DLL (sfml-xxx-d.dll) and Debug static (sfml-xxx-s-d.lib).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question on window tutorial
« Reply #10 on: January 22, 2010, 11:13:37 pm »
Quote
When compiling the Release DLLs it says:
Rebuild All: 1 succeeded, 5 failed, 12 skipped

But all files are there. Could that be a problem?

The 5 projects that fail are probably samples. You can easily see that in the output tab.

Quote
How can I create the "sfml-xxx-d.lib" files? I only can choose between Debug DLL (sfml-xxx-d.dll) and Debug static (sfml-xxx-s-d.lib).

Hmm, you should also have "Release static" and "Release DLL". Maybe something went wrong with the conversion wizard?
Laurent Gomila - SFML developer

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #11 on: January 22, 2010, 11:41:56 pm »
Quote
Hmm, you should also have "Release static" and "Release DLL". Maybe something went wrong with the conversion wizard?

Sorry, I was a bit imprecise here.

I meant that "Debug DLL" and "Debug static" are the only two "debug modes" that I can choose between. I assume that for the "sfml-xxx-d.lib" I need a simple "Debug", like the one I can choose for the "sfml-main" project.

There are also "Release static" and "Release DLL" but none of them results in "sfml-xxx-d.lib" files.

bnz

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question on window tutorial
« Reply #12 on: January 23, 2010, 10:15:32 am »
No no, sfml-xxx-d.lib is the dynamic debug version.

Suffixes are defined so that "-d" is debug and "-s" is static (release and dynamic have no suffix).
Laurent Gomila - SFML developer

bnz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question on window tutorial
« Reply #13 on: January 23, 2010, 01:04:40 pm »
Okay, but how can I create the "sfml-xxx-d.lib" files?
Here are some screenshots, that show all different configurations I tried:


And these are the resulting files:


(By the way: Can I delete the .ilk files? )
As you see, the "sfml-xxx-d.lib" files are missing.

Since this is the first library I have to compile by myself, please forgive my, if my questions are trivial. =)

bnz

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question on window tutorial
« Reply #14 on: January 23, 2010, 02:09:47 pm »
You don't change the current active configuration in this window (this is the solution's properties, I almost never go there), you just setup which configuration for each project correspond to the "global" configuration (the one in the top-left corner). Like I said, you don't have to do such complicated things to build SFML ;)

To actually select the configuration to build, you should have a combobox in the toolbar.
Laurent Gomila - SFML developer

 

anything