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

Author Topic: Problems with networking examples (APPCRASH + undefined reference)  (Read 3827 times)

0 Members and 1 Guest are viewing this topic.

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Hi guys, I'm new here and I'd like to ask some help from you.

Relatively I'm new to SFML too, I only used its "Audio" part a couple of years ago, and it worked like a charm (version 1.6).
Now I'm trying to learn the basics of networking, but I can't get it work.

First of all, I tried to run the pre-compiled "sockets.exe" in the examples folder of SFML 2.0, but it crashes after selecting from the 2 options (t/u, s/c).

Quote
Problem signature:
  Problem Event Name:   APPCRASH
  Application Name:   sockets.exe
  Application Version:   0.0.0.0
  Application Timestamp:   51613f31
  Fault Module Name:   libstdc++-6.dll
  Fault Module Version:   0.0.0.0
  Fault Module Timestamp:   4bc96cae
  Exception Code:   c0000005
  Exception Offset:   000462f3
  OS Version:   6.1.7601.2.1.0.768.3
  Locale ID:   1038
  Additional Information 1:   0a9e
  Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:   0a9e
  Additional Information 4:   0a9e372d3b4ad19135b953a78882e789


After this, I've found a simple example, but I can't compile it.
Project options:
Directories/Library Dir.   F:/SFML-2.0/lib
Directories/Include Dir.   F:/SFML-2.0/include
Parameters/Linker      F:/SFML-2.0/lib/libsfml-network.a

The code itself:

(click to show/hide)

Error (Dev-Cpp 4.9.9.2):
Quote
In function `main': [Linker error] undefined reference to `_imp___ZN2sf4Time4ZeroE'
ld returned 1 exit status
[Build Error]  [F:/Network_example/network.exe] Error 1

Error (Code::Blocks 13.12):
Quote
|=== Build: default in Network_example (compiler: GNU GCC Compiler) ===|
.objs\main.o:main.cpp|| undefined reference to `_imp___ZN2sf4Time4ZeroE'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|


Thanks in advance for the help.
Greetings!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #1 on: October 06, 2015, 11:01:59 am »
IIRC sf::Time::Zero was added after SFML 2.0. Since there's no reason to use SFML 2.0 over SFML 2.3.2, just upgrade the version and it should start working.

As for the error, it just seems to miss the specific DLL or similar.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #2 on: October 06, 2015, 11:36:29 am »
I've downloaded SFML 2.3.2 as you say and I've updated the Project options.
However, I'm still getting the same error with Dev-Cpp and with CodeBlocks too.

The other problem: I have that DLL, and the program starts, but it crashes when it tries to open the given port (or whatever it tries to do after selecting t/u, s/c).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #3 on: October 06, 2015, 11:46:26 am »
Did you also update the paths in Dev-Cpp/Code::Blocks?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #4 on: October 06, 2015, 11:55:01 am »
Yes, when I said "I've updated the Project options" it meant that I've updated the paths, sorry if it was equivocal.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #5 on: October 06, 2015, 01:06:03 pm »
Did you link against the sfml-system module?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #6 on: October 06, 2015, 01:46:45 pm »
Now I tried to include all of these: Graphics.hpp,Window.hpp,Audio.hpp,Network.hpp,System.hpp (and of course I've modified the linking too).
Now it successfully compiled, but I'm getting an application error (0xc000007b), when trying to run it.
I tried to google it, but couldn't find an appropriate answer to solve it.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #7 on: October 06, 2015, 01:49:24 pm »
You don't need to include the header files if you don't use them, but the sfml-network depends on the sfml-system module, thus you need to link against both.
The 0xc0000007b error usually means that you're mixing x64 and x86 versions. Have you updated your DLLs?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #8 on: October 06, 2015, 02:03:57 pm »
Yes, I copied the necessary dlls from SFML-2.3.2/bin to the project's folder.
First, it throwed a "libstdc++-6.dll" error (_ZSt24_thros_out_of_range_fmtPKcz), then I've found an older version of this dll and replaced it.
But after this, it throws the 0xc000007b error.

I don't know if it counts or not, but I've compiled it with both Dev-Cpp (mingw32 version: 3.4.2) and with CodeBlocks (mingw32 version: 4.7.1), but both version behaves exactly the same.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #9 on: October 06, 2015, 02:14:39 pm »
You can't just use a random DLL with the specific name. The library you use must exactly match whatever compiler you use. If you want to keep using Dev CPP you most definitely should update, SFML at least does not provide any compatible binaries for MinGW 3.4.2.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #10 on: October 06, 2015, 02:21:24 pm »
You're right, but as I said, I've compiled it with CodeBlocks and with mingw 4.7.1 too.
And first, I tried to use the libstdc++-6.dll from the CodeBlocks/MinGW directory, but it gave me that "The procedure entry point (_ZSt24_throw_out_of_range_fmtPKcz) could not be located in the dynamic library libstdc++-6.dll" error.

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #11 on: October 06, 2015, 02:28:12 pm »
Now I realized that previously I've downloaded "GCC 4.9.2 MinGW (DW2) - 32-bit", but I should have downloaded "GCC 4.7.1 TDM (SJLJ) - 32-bit" instead, I guess.
Now the program starts, but it displays only the "system("pause");" command, none of the above.
Can you explain this?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #12 on: October 06, 2015, 02:34:23 pm »
If you compile and run the posted code, I wouldn't know why that would happen.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dr84

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Problems with networking examples (APPCRASH + undefined reference)
« Reply #13 on: October 06, 2015, 02:47:57 pm »
It's really weird.. I started a blank project, set up project options like before, copied the code like before, copied the dlls to program folder like before, and now it works.
I can't really say what did I do differently this time, but finally it works.
Thanks for your time and for your help!