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

Author Topic: SFML failing to initialize in debug mode  (Read 3458 times)

0 Members and 1 Guest are viewing this topic.

retep998

  • Newbie
  • *
  • Posts: 17
    • View Profile
SFML failing to initialize in debug mode
« on: December 13, 2010, 06:30:56 am »
Got the latest version of sfml2 from the svn just this night.
Everything built properly for vc++ 2010
Made a project, included headers and linked libraries as usual.
When I run it, the console window opens, but nothing happens.
I paused the program and noticed it hadn't even reached the main function yet.
It was stuck at
myContext = wglCreateContext(myDeviceContext);
on line 291 of WglContext.cpp
Strangely, release mode still works fine. Only debug mode fails.
My program doesn't do anything yet, its just a main function that returns.
I have an ATI Radeon 3200 with the latest drivers.
Until this gets fixed, it looks like I'm stuck with release mode. It'd be nice to be able to debug my program though...

EDIT: Now when I try to add a window, the program fails again, even in release mode.
It gets stuck at
++pfbegin;
on line 873 of crt0dat.c
Now I'm stuck, unable to do anything.

EDIT: I switched to using static libraries and it seems all my problems have vanished. Still, you should probably investigate why dynamic is causing issues.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML failing to initialize in debug mode
« Reply #1 on: December 13, 2010, 08:16:03 am »
As far as I know there's no bug on startup, even with ATI cards. So we should first check if you did everything properly. How did you compile SFML? What compiler/linker options do you use? What libraries do you link to?
Laurent Gomila - SFML developer

retep998

  • Newbie
  • *
  • Posts: 17
    • View Profile
SFML failing to initialize in debug mode
« Reply #2 on: December 13, 2010, 08:47:09 am »
I followed the SFML 2 tutorial exactly for building using visual studio 2010 with cmake.
It built perfectly.
Then I opened a new project, and linked the following libraries
sfml-window.lib
sfml-system.lib
sfml-graphics.lib
sfml-audio.lib
sfml-network.lib
With -d for debug mode
I didn't define any preprocessor directives or mess with anything.
I had all the dlls included in the project directory like I do with dll's in other projects.
I created my main.cpp with my main function and included
#include <SFML/OpenGL.hpp>
#include <SFML/Graphics.hpp>
Then when I tried to make a simple window, whether its a renderwindow, or just a plain old window, with all sorts of various settings, the program would get stuck without even executing the main function.
I tried both console and non-console and neither worked.
I added in sfml-main.lib and also glu32.lib and opengl32.lib, and it still didn't work.
But switching to static libraries like I use normally, instantly fixed everything.
I have absolutely no idea what's going on wrong.
Also, I'm on an AMD64 computer, but I'm building everything in 32 bit.
As far as I can tell, the ONLY differences are that I unchecked the box for shared stuff in cmake, I added -s to the library names, and I added the SFML_STATIC macro.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML failing to initialize in debug mode
« Reply #3 on: December 13, 2010, 09:25:02 am »
Are you sure that you use the right DLLs (sometimes there are old DLLs that are still conflicting somewhere)?

Can you show me the complete call stack after the crash?
Laurent Gomila - SFML developer

retep998

  • Newbie
  • *
  • Posts: 17
    • View Profile
SFML failing to initialize in debug mode
« Reply #4 on: December 13, 2010, 09:37:58 am »
I never did the dynamic build before, and I made sure I completely cleared all the old files.
Call stack for release mode
Code: [Select]
ntdll.dll!77ccf861()
  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
  ntdll.dll!77ccf861()
  KernelBase.dll!75ce0816()
  aticfx32.dll!622c38f9()
  aticfx32.dll!622bf4b3()
  aticfx32.dll!622ca847()
  aticfx32.dll!622b833c()
  aticfx32.dll!622b64bd()
  atigktxx.dll!59361f43()
  atioglxx.dll!6907a4cb()
  atioglxx.dll!69d1db9e()
  atioglxx.dll!69b3aa2a()
  atioglxx.dll!69ba2745()
  atioglxx.dll!69ba2c90()
  atioglxx.dll!69ba2c90()
  atioglxx.dll!69047c65()
  opengl32.dll!57a7b1fb()
  opengl32.dll!57a7b6cd()
  opengl32.dll!57a7b83c()
  opengl32.dll!57a7b8ef()
  sfml-window-2.dll!5a6d4079()
  user32.dll!759e6a8b()
  user32.dll!759ddb47()
  user32.dll!759da619()
  sfml-window-2.dll!5a6d41c0()
  sfml-window-2.dll!5a6d6e8c()
> msvcr100.dll!_initterm(void (void)* * pfbegin, void (void)* * pfend)  Line 873 C
  sfml-window-2.dll!5a6d64de()
  sfml-window-2.dll!5a6d667e()
  sfml-window-2.dll!5a6d674b()
  ntdll.dll!77ce97a0()
  ntdll.dll!77ced749()
  ntdll.dll!77cede27()
  ntdll.dll!77cf6a3e()
  ntdll.dll!77cf5947()
  ntdll.dll!77ce9cc9()


And for debug mode
Code: [Select]
ntdll.dll!77ccf861()
  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
  ntdll.dll!77ccf861()
  KernelBase.dll!75ce0816()
  aticfx32.dll!622c38f9()
  aticfx32.dll!622bf4b3()
  aticfx32.dll!622ca847()
  aticfx32.dll!622b833c()
  aticfx32.dll!622b64bd()
  atigktxx.dll!588e1f43()
  atioglxx.dll!6907a4cb()
  atioglxx.dll!69d1db9e()
  atioglxx.dll!69b3aa2a()
  atioglxx.dll!69ba2745()
  atioglxx.dll!69ba2c90()
  atioglxx.dll!69ba2c90()
  atioglxx.dll!69047c65()
  opengl32.dll!577eb6cd()
  opengl32.dll!577eb83c()
  opengl32.dll!577eb8ef()
> sfml-window-d-2.dll!sf::priv::WglContext::CreateContext(sf::priv::WglContext * shared, unsigned int bitsPerPixel, const sf::ContextSettings & settings)  Line 291 + 0xf bytes C++
  sfml-window-d-2.dll!sf::priv::WglContext::WglContext(sf::priv::WglContext * shared)  Line 62 C++
  sfml-window-d-2.dll!`anonymous namespace'::`dynamic initializer for 'referenceContext''()  Line 66 + 0xf bytes C++
  msvcr100d.dll!_initterm(void (void)* * pfbegin, void (void)* * pfend)  Line 873 C
  sfml-window-d-2.dll!_CRT_INIT(void * hDllHandle, unsigned long dwReason, void * lpreserved)  Line 284 + 0xf bytes C
  sfml-window-d-2.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved)  Line 506 + 0x11 bytes C
  sfml-window-d-2.dll!_DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved)  Line 476 + 0x11 bytes C
  ntdll.dll!77ce97a0()
  ntdll.dll!77ced749()
  ntdll.dll!77cede27()
  ntdll.dll!77cf6a3e()
  ntdll.dll!77cf5947()
  ntdll.dll!77ce9cc9()

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML failing to initialize in debug mode
« Reply #5 on: December 13, 2010, 09:57:34 am »
Ok thanks. I'll try to test this as soon as possible.
Laurent Gomila - SFML developer

Wollnashorn

  • Newbie
  • *
  • Posts: 3
    • View Profile
SFML failing to initialize in debug mode
« Reply #6 on: December 16, 2010, 01:44:52 pm »
Quote from: "Laurent"
As far as I know there's no bug on startup, even with ATI cards. So we should first check if you did everything properly. How did you compile SFML? What compiler/linker options do you use? What libraries do you link to?
There are a lots of users who have this problem.
It's a bug with the new ATI driver-version and SFML. I have it too...

Would be awesome if you fix it. :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML failing to initialize in debug mode
« Reply #7 on: December 16, 2010, 01:50:58 pm »
I think it will be fixed at the same time as the global exit crash.
Laurent Gomila - SFML developer

 

anything