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

Author Topic: [Solved] SFML 2RC crashes undebuggable when downloading a file  (Read 3478 times)

0 Members and 1 Guest are viewing this topic.

JoshuaBehrens

  • Newbie
  • *
  • Posts: 35
    • View Profile
Hello guys,

I tried this:
#include <SFML/Network.hpp>

#include <map>
#include <list>
#include <string>
#include <cstdio>

bool retrieveLines( const std::string& url, const std::string& file, const std::map< std::string, std::string >& params, std::list< std::string >& out )
{
    sf::Http http( url );
    sf::Http::Request req( file );
    req.setMethod(sf::Http::Request::Get);
    req.setBody("");
    req.setHttpVersion(1, 0);
    for ( std::map< std::string, std::string >::const_iterator cit( params.begin( ) ) ; cit != params.end( ) ; ++cit )
        req.setField( cit->first, cit->second );

    sf::Http::Response res = http.sendRequest( req );

    if ( res.getStatus( ) == 200 )
    {
        printf( "body from %s:\n%s\n", url.c_str( ), res.getBody( ).c_str( ) );
        return true;
    }
    return false;
}

int main( int argc, char** args )
{
    std::map< std::string, std::string > pars;
    std::list< std::string > lines;
    retrieveLines( "joshua-behrens.de","/index.php", pars, lines );

    return 0;
}
But it always closed my console with a very high return number. It is also undebuggable. gdb stops neither on any breakpoint nor any other point where an error could occur. But gdb is fine in other projects. DLLs are with the console, I linked against network-d and system-d. Any hints?
Thanks in advance, JoshuaBehrens
« Last Edit: March 09, 2013, 10:40:09 pm by JoshuaBehrens »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #1 on: March 08, 2013, 11:08:02 pm »
What OS are you using and which compiler version?
The title says SFML 2 RC, so you've downloaded the RC from the website?

I suspect, that you'll have to recompile SFML for your compiler (or maybe my Nightly Builds can help out).

Anyways it works fine on my end.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JoshuaBehrens

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #2 on: March 09, 2013, 10:52:59 am »
Well ... Exploiter ... you helped me to compile the RC last time :D not a week ago

After a restart it started (started c::b with adminrights) and now he complains that he could not find "_ZN2sf4Http11sendRequestERKNS0_7RequestENS_4TimeE" in DLL "sfml-network-d-2.dll".

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #3 on: March 09, 2013, 11:07:34 am »
Well ... Exploiter ... you helped me to compile the RC last time :D not a week ago
Ah that was you! Well I help out so many people here on the forum, that I usually don't remember exactly whom I helped with what and only start to recognize people if they appear more regularly. ;)

Also if you have compiled SFML from GitHub then you shouldn't call it RC, because RC means Release Candidate and is just one specific type. ;)

After a restart it started (started c::b with adminrights) and now he complains that he could not find "_ZN2sf4Http11sendRequestERKNS0_7RequestENS_4TimeE" in DLL "sfml-network-d-2.dll".
Make sure that you're IDE is set to debug mode, that you've linked SFML in the correct order (graphics, window, network, system) and that SFML_STATIC is not defined.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JoshuaBehrens

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #4 on: March 09, 2013, 11:42:08 am »
I start C::B as admin (so the toolchain should too?) I just link against network and system using this command: -lsfml-network-d -lsfml-system-d, SFML_STATIC is not defined due to this snippet in front
#ifdef SMFL_STATIC
    #error does not work with static
#endif // SMFL_STATIC
and it compiled fine.

The compiled application asks for sfml-network-d-2.dll, but I only have sfml-network-d.dll from the compilation of SFML 2. I renamed the dll then I throws this error.

than I just say I used the latest SFML 2 ^^

I would also be fine when I have to use boost::asio, because it's just about a filedownload, but SFML has an easier interface for http.
« Last Edit: March 09, 2013, 11:50:53 am by JoshuaBehrens »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #5 on: March 09, 2013, 02:14:56 pm »
Quote
The compiled application asks for sfml-network-d-2.dll, but I only have sfml-network-d.dll from the compilation of SFML 2
So there's obviously something wrong, you should never have to manually rename files ;)

How did you recompile SFML?
Laurent Gomila - SFML developer


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #7 on: March 09, 2013, 03:24:37 pm »
In this video, the filenames are correct.
Laurent Gomila - SFML developer

JoshuaBehrens

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: SFML 2RC crashes undebuggable when downloading a file
« Reply #8 on: March 09, 2013, 03:41:15 pm »
Well I just recompiled all ... and well it works now. Creepy sfml-bins I have. I have no idea why they were not named sfml 2. But it worked as you can see here: http://de.twitch.tv/joshuabehrens/b/375614633
« Last Edit: March 09, 2013, 03:44:14 pm by JoshuaBehrens »