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

Author Topic: Static linking network module gives multiple definition of `socket'  (Read 2768 times)

0 Members and 2 Guests are viewing this topic.

Maydell

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Hello SFML-community!
I've been struggling all day with trying to compile my SFML-project using static libraries and I think I've almost gotten it to work but now I get an error telling me I have multiple definitions of `socket'. I'm linking the following libraries when compiling:

-static-libgcc -static-libstdc++ -lsfml-network-s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -ljpeg -lwinmm -lgdi32 -lws2_32

When it gets to the ws2_32 library I get the error:

C:/(.......really long path......)/lib/libws2_32.a(dwzfs00181.o):(.text+0x0): multiple definition of `socket'
main.o:main.cpp:(.bss+0x0): first defined here


I've included my Makefile. Sorry if I missed some other important information, I'll be happy to post anything that could help you get an idea about what could be the problem.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Static linking network module gives multiple definition of `socket'
« Reply #1 on: April 18, 2016, 09:40:37 pm »
Do you use using namespace sf;?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Maydell

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Static linking network module gives multiple definition of `socket'
« Reply #2 on: April 18, 2016, 09:43:02 pm »
Do you mean in my code? No I don't, I usually prefer placing sf:: infront of everything instead. Should I try with using namespace sf?

Maydell

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Static linking network module gives multiple definition of `socket'
« Reply #3 on: April 18, 2016, 09:48:55 pm »
Since this is a linking error, that shouldn't make a difference though, right?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Static linking network module gives multiple definition of `socket'
« Reply #4 on: April 18, 2016, 11:28:10 pm »
Do you mean in my code? No I don't, I usually prefer placing sf:: infront of everything instead. Should I try with using namespace sf?
No.

Since this is a linking error, that shouldn't make a difference though, right?
Well I've no idea what it really is, since you didn't provide the full error.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Maydell

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Static linking network module gives multiple definition of `socket'
« Reply #5 on: April 18, 2016, 11:50:07 pm »
The error I posted is actually the whole error. I can paste the entire output but the rest is just standard successful compiling output.