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

Author Topic: Trying to link statically, crashes on launch  (Read 1761 times)

0 Members and 1 Guest are viewing this topic.

Sumzary

  • Guest
Trying to link statically, crashes on launch
« on: October 24, 2012, 11:14:30 am »
I have a problem with starting my program, it crashes on launch. It doesn't even get to the main loop.
There is no issues when compiling, and the .dlls are in the folder with the .exe.

This is my .pro file, cut down in size:

TEMPLATE = app
CONFIG -= qt
RC_FILE = recources.rc

DEFINES +=

LIBS += C:/SFML/lib/sfml-graphics-s.lib \
        C:/SFML/lib/sfml-window-s.lib \
        C:/SFML/lib/sfml-system-s.lib \
        C:/SFML/lib/sfml-audio-s.lib \
        C:/SFML/lib/sfml-main.lib \
        C:/SFML/lib/Box2D.lib \
        gdi32.lib \
        user32.lib \
        kernel32.lib \

INCLUDEPATH += C:/SFML/include \

SOURCES += \
    Vania.cpp \
 

I am using the Qt Creator IDE on winXP with SFML 1.6.
« Last Edit: October 24, 2012, 11:17:10 am by Sumzary »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Trying to link statically, crashes on launch
« Reply #1 on: October 24, 2012, 11:22:06 am »
What message do you get with the crash? What does the debugger says?

By the way, you should link to debug libraries in the debug configuration, instead of using the release libraries for all configurations.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: Trying to link statically, crashes on launch
« Reply #2 on: October 24, 2012, 11:26:38 am »
Also which compiler do you use exactly?

If you link statically there's no reason for the dlls. ;)

I'd advise you to use SFML 2, because SFML 1.6 is over 2y old, contains many bugs and lacks a lot of features... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sumzary

  • Guest
Re: Trying to link statically, crashes on launch
« Reply #3 on: October 24, 2012, 01:08:36 pm »
Ok, I should explain a bit more >:]
I couldn't use 2.0 because all 2.0 apps had the mouse moving - program freezing issue.
So I started my platformer project in 1.6, I was using dynamic linking, I got into Box2D and all was fine.
Then I wanted to write some text on the main menu, and to do that, I needed to load a font.
When I did however, I got this error when compiling:

    LNK2019: unresolved external symbol "private: static unsigned int * sf::Font::ourDefaultCharset" (?ourDefaultCharset@Font@sf@@0PAIA)

Then I read somewhere to try do it statically and did so, but I get the crashing on launch problem with this error:

Vania has encountered a problem and needs to close.
We are sorry for the inconvenience. :'(

I use the vs2008 compiler, and yeh, the dlls don't really need to be there.

I'm setting up debug now, It'll take a while to download :P
Both dynamic and static would be fine, any suggestion are much appreciated.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Trying to link statically, crashes on launch
« Reply #4 on: October 24, 2012, 01:13:07 pm »
And you don't define SFML_DYNAMIC with the static libs anymore, right?

You run things through the debugger and find out where the application crashes with the callstack. ;)

If you're using any global objects (specially resources) then this might very well be the source of your problem...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Trying to link statically, crashes on launch
« Reply #5 on: October 24, 2012, 01:14:44 pm »
Quote
I couldn't use 2.0 because all 2.0 apps had the mouse moving - program freezing issue.
What issue? It would be nice to make a report, or post a link to the issue if it's a known one ;)
Laurent Gomila - SFML developer