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

Author Topic: Microsoft Visual C++ 2010 Express problems.  (Read 7138 times)

0 Members and 3 Guests are viewing this topic.

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« on: December 01, 2010, 05:43:41 am »
Hi!

Firstly, sorry if I'm just being stupid - I've always wanted and tried to be a computer geek but sometimes I just think it may not be for me...


Anyway, my problem is this: When I build/compile (whichever is the proper word) the following code

Code: [Select]

#pragma comment (lib, "sfml-window.lib")
#include <SFML/Window.hpp>
#include <iostream>

#define width 800
#define length 600
#define depth 32


int main()
{
sf::Window MainWindow(sf::VideoMode(width, length, depth), "Tester");
bool running = false;
while (running);
{
MainWindow.Display();

}
return 0;
}


works fine - I had big problems with getting the libs and linkers and whatnot to work correctly, so I was pretty bummed to see that when I actually run this I get an error saying

"Run-Time check failure #2 - Stack around the variable "MainWindow" was corrupted."

If I hit the Continue button after this, I get another message telling me that the .exe has been "buffer overrun, corrupting the internal state of the program".


I could do the tutorials fine on Bloodshed Dev-Cpp, which leads me to believe that I've done something wrong, or have forgotten something.

Not being able to finish even the first tutorial makes me a sad panda, truly.


Thanks for any replies!

Sincerely,

AngelHoof

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #1 on: December 01, 2010, 08:02:03 am »
You must link to debug libraries (-s) in debug mode. This is explained in bold characters in the "getting started" tutorial... :cry:

And if you're using Visual C++ 2010, you'll have to recompile SFML as there's no precompiled libraries for this compiler (VC++ 2008 libraries are not compatible).
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« Reply #2 on: December 01, 2010, 08:35:10 am »
Oh crap, I'm embarassed now.

Sorry Laurent! I'm really bad with this kind of stuff, I realize that it was an unbelievably stupid miss  :oops:

I changed the #pragma to sfml-window-d (as the tutorial stated), and put the -d .dll's in my system32 folder... It compiles fines, fires the console but gives me this now;

"Unhandled exception at 0x76bbcdeb in GameRPG.exe: 0xC0000005: Access violation reading location 0xcc007265."


But... You say that I should use -s?

sfml-window-s.lib doesn't even let me compile :/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #3 on: December 01, 2010, 08:51:54 am »
Quote
And if you're using Visual C++ 2010, you'll have to recompile SFML as there's no precompiled libraries for this compiler (VC++ 2008 libraries are not compatible).
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« Reply #4 on: December 01, 2010, 11:59:00 am »
Ah, yes, which I was intending to ask about how to do...

Sorry if I'm comming out as a complete retard - I'm doing my best  :?


I followed the instructions on the bottom of the VC Getting Started tutorial, when I run the SFML.sln it just asks which program to open it with, I pick VC C++ Express 2010 (obviously) and then it starts "converting" the files, which it fails at with pretty much everything except for the sfml-main/window/graphics/audio/network etc.

I'm assuming this is not how it was meant to be played out, so what am I doing wrong?


Sincerely,

AngelHoof

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #5 on: December 01, 2010, 12:04:37 pm »
Quote
it fails at with pretty much everything except for the sfml-main/window/graphics/audio/network etc.

So it fails for everything except everything? :D
If you have sfml-main/window/graphics/audio/network then you have SFML. You don't need to care about the samples.

Quote
I'm assuming this is not how it was meant to be played out, so what am I doing wrong?

If you have problems with the conversion, you can find a lot of other topics that may help you on this forum. A member has even made a video tutorial somewhere.
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« Reply #6 on: December 01, 2010, 12:21:24 pm »
Well, it says that it successfully converted the main/window and whatnot, so how come It's still not working?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #7 on: December 01, 2010, 12:40:56 pm »
Quote
It's still not working?

What did you do after converting? Did you compile the release-dynamic configuration? What errors do you get, still the same?
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« Reply #8 on: December 01, 2010, 12:51:08 pm »
Quote from: "Laurent"
Quote
It's still not working?

 What errors do you get, still the same?


Yes, the same.

Quote from: "Laurent"
Did you compile the release-dynamic configuration?


I wish I could answer that - Umm, I'm gonna have to go with "No" though  :o

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #9 on: December 01, 2010, 01:24:15 pm »
Quote
I wish I could answer that - Umm, I'm gonna have to go with "No" though

You can select the configuration in the dropdown combobox in the toolbar.
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« Reply #10 on: December 01, 2010, 01:48:07 pm »
Through the configuration manager?

If so, i have 4 options, release-static, release-dll, debug-static and debug-dll.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #11 on: December 01, 2010, 01:52:19 pm »
Yep, release-dll is what you use in your project.
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
Microsoft Visual C++ 2010 Express problems.
« Reply #12 on: December 01, 2010, 02:03:51 pm »
Okay... I set them all to release-dll in the "SFML" project, saved all the project files... Umm, still aint working  :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Microsoft Visual C++ 2010 Express problems.
« Reply #13 on: December 01, 2010, 02:10:42 pm »
Sorry to ask such a stupid question, but did you actually compile SFML after selecting the configuration? And properly use the new libraries in your project?
Laurent Gomila - SFML developer