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

Author Topic: Unresolved external from static library Visual Studio 2013  (Read 10737 times)

0 Members and 1 Guest are viewing this topic.

Peteck

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Unresolved external from static library Visual Studio 2013
« on: March 18, 2014, 10:28:28 pm »
Hi!

I've upgraded my visual studio to 2013 lately and have been recompiling the libraries.
Everything have been working like a charm, untill i tried to use a class from the network library ...  :(

I'm linking it correctly with "sfml-network-s-d.lib", "SFML_STATIC" and so on..

I get no error compiling SFML in Visual Studio 2013.

I dont have a log on this computer, but i it's just ALOT of unresolved externals. Nothing about "__declspec(dllimport". Its like the whole static library is broken, but the library is being compiled without any error.

Anyone who have a idea whats wrong? The only idea I have right now is going back to Visual Studio 2012 and use the precompiled libraries.

UPDATE:

Here is a simple test code
#include <SFML\Network.hpp>

int main()
{
        sf::TcpSocket socket;
        return 0;
}

Here is my log
Error   1       error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function "protected: void __thiscall sf::Socket::create(unsigned int)" (?create@Socket@sf@@IAEXI@Z)        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(Socket.obj)      Testing
Error   2       error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "protected: void __thiscall sf::Socket::create(void)" (?create@Socket@sf@@IAEXXZ)     C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(Socket.obj)      Testing
Error   3       error LNK2001: unresolved external symbol __imp__socket@12      C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   4       error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "public: enum sf::Socket::Status __thiscall sf::TcpSocket::connect(class sf::IpAddress const &,unsigned short,class sf::Time)" (?connect@TcpSocket@sf@@QAE?AW4Status@Socket@2@ABVIpAddress@2@GVTime@2@@Z)    C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   5       error LNK2001: unresolved external symbol __imp__connect@12     C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   6       error LNK2019: unresolved external symbol __imp__getpeername@12 referenced in function "public: class sf::IpAddress __thiscall sf::TcpSocket::getRemoteAddress(void)const " (?getRemoteAddress@TcpSocket@sf@@QBE?AVIpAddress@2@XZ)      C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   7       error LNK2019: unresolved external symbol __imp__getsockname@12 referenced in function "public: unsigned short __thiscall sf::TcpSocket::getLocalPort(void)const " (?getLocalPort@TcpSocket@sf@@QBEGXZ) C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   8       error LNK2001: unresolved external symbol __imp__getsockname@12 C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   9       error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function "public: enum sf::Socket::Status __thiscall sf::TcpSocket::send(class sf::Packet &)" (?send@TcpSocket@sf@@QAE?AW4Status@Socket@2@AAVPacket@2@@Z)        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   10      error LNK2001: unresolved external symbol __imp__htonl@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   11      error LNK2001: unresolved external symbol __imp__htonl@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   12      error LNK2001: unresolved external symbol __imp__htonl@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(Packet.obj)      Testing
Error   13      error LNK2019: unresolved external symbol __imp__ntohl@4 referenced in function "public: class sf::IpAddress __thiscall sf::TcpSocket::getRemoteAddress(void)const " (?getRemoteAddress@TcpSocket@sf@@QBE?AVIpAddress@2@XZ)     C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   14      error LNK2001: unresolved external symbol __imp__ntohl@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   15      error LNK2001: unresolved external symbol __imp__ntohl@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(Packet.obj)      Testing
Error   16      error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function "public: unsigned short __thiscall sf::TcpSocket::getLocalPort(void)const " (?getLocalPort@TcpSocket@sf@@QBEGXZ)        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   17      error LNK2001: unresolved external symbol __imp__ntohs@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(Packet.obj)      Testing
Error   18      error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "public: enum sf::Socket::Status __thiscall sf::TcpSocket::receive(void *,unsigned int,unsigned int &)" (?receive@TcpSocket@sf@@QAE?AW4Status@Socket@2@PAXIAAI@Z)       C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   19      error LNK2019: unresolved external symbol __imp__select@20 referenced in function "public: enum sf::Socket::Status __thiscall sf::TcpSocket::connect(class sf::IpAddress const &,unsigned short,class sf::Time)" (?connect@TcpSocket@sf@@QAE?AW4Status@Socket@2@ABVIpAddress@2@GVTime@2@@Z)     C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   20      error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: enum sf::Socket::Status __thiscall sf::TcpSocket::send(void const *,unsigned int)" (?send@TcpSocket@sf@@QAE?AW4Status@Socket@2@PBXI@Z) C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(TcpSocket.obj)   Testing
Error   21      error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: static void __cdecl sf::priv::SocketImpl::close(unsigned int)" (?close@SocketImpl@priv@sf@@SAXI@Z)       C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   22      error LNK2019: unresolved external symbol __imp__ioctlsocket@12 referenced in function "public: static void __cdecl sf::priv::SocketImpl::setBlocking(unsigned int,bool)" (?setBlocking@SocketImpl@priv@sf@@SAXI_N@Z)   C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   23      error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "public: static struct sockaddr_in __cdecl sf::priv::SocketImpl::createAddress(unsigned int,unsigned short)" (?createAddress@SocketImpl@priv@sf@@SA?AUsockaddr_in@@IG@Z)        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   24      error LNK2001: unresolved external symbol __imp__htons@4        C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(Packet.obj)      Testing
Error   25      error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: __thiscall sf::priv::SocketInitializer::SocketInitializer(void)" (??0SocketInitializer@priv@sf@@QAE@XZ)   C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   26      error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: __thiscall sf::priv::SocketInitializer::~SocketInitializer(void)" (??1SocketInitializer@priv@sf@@QAE@XZ)  C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   27      error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "public: static enum sf::Socket::Status __cdecl sf::priv::SocketImpl::getErrorStatus(void)" (?getErrorStatus@SocketImpl@priv@sf@@SA?AW4Status@Socket@3@XZ)    C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(SocketImpl.obj)  Testing
Error   28      error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "unsigned int __cdecl `anonymous namespace'::resolve(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?resolve@?A0xffb3341e@@YAIABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)       C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   29      error LNK2019: unresolved external symbol __imp__inet_ntoa@4 referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall sf::IpAddress::toString(void)const " (?toString@IpAddress@sf@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)    C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   30      error LNK2019: unresolved external symbol __imp__getaddrinfo@16 referenced in function "unsigned int __cdecl `anonymous namespace'::resolve(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?resolve@?A0xffb3341e@@YAIABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)    C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   31      error LNK2019: unresolved external symbol __imp__freeaddrinfo@4 referenced in function "unsigned int __cdecl `anonymous namespace'::resolve(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?resolve@?A0xffb3341e@@YAIABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)    C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Testing\sfml-network-s-d.lib(IpAddress.obj)   Testing
Error   32      error LNK1120: 21 unresolved externals  C:\Users\Peter Bech\documents\visual studio 2013\Projects\Testing\Debug\Testing.exe     Testing
 
« Last Edit: March 18, 2014, 10:39:18 pm by Peteck »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Unresolved external from static library Visual Studio 2013
« Reply #1 on: March 18, 2014, 11:09:34 pm »
The latest Git version has changes regarding static linkage, see here.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Peteck

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Unresolved external from static library Visual Studio 2013
« Reply #2 on: March 18, 2014, 11:36:50 pm »
Oooh, I just missed a library ... stupid me!

#pragma comment(lib, "ws2_32.lib")

and now its working :-)

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Unresolved external from static library Visual Studio 2013
« Reply #3 on: March 19, 2014, 03:24:40 am »
Oooh, I just missed a library ... stupid me!

#pragma comment(lib, "ws2_32.lib")

and now its working :-)

Please don't link this way, it is not cross platform and writing non cross platform code is a very bad habit once started.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Peteck

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Unresolved external from static library Visual Studio 2013
« Reply #4 on: March 19, 2014, 08:29:18 am »
Please don't link this way, it is not cross platform and writing non cross platform code is a very bad habit once started.

I know that it is non-cross platform and I noramlly don't link that way. But thanks for reminding me.