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

Author Topic: VS2013 unable to staically link the library "Network"  (Read 6747 times)

0 Members and 1 Guest are viewing this topic.

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
VS2013 unable to staically link the library "Network"
« on: August 13, 2014, 09:09:15 am »
Im new to SFML it looks great but im unable to make it work, Im using the SFML-2.1  for VS2012 since i coulnt find it for VS2013.


Im trying to link statically to my project like this

#include "stdafx.h"


#include <iostream>
#include <SFML\Network.hpp>
#include <sstream>
#include <string>
#include <vector>

#define SFML_STATIC

#pragma comment(lib, "sfml-network-s.lib")
#pragma comment(lib, "sfml-system-s.lib")

I already specified the library Path also the include path also note im using the libs with the -s suffix for static but it fails to compile with this errors:

Error   6       error LNK1120: 5 unresolved externals   E:\Projectos\C++\TestConn\Release\TestConn.exe  TestConn
Error   4       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::IpAddress::IpAddress(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0IpAddress@sf@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)  E:\Projectos\C++\TestConn\TestConn\TestConn.obj TestConn
Error   2       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::TcpSocket::TcpSocket(void)" (__imp_??0TcpSocket@sf@@QAE@XZ)     E:\Projectos\C++\TestConn\TestConn\TestConn.obj TestConn
Error   1       error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum sf::Socket::Status __thiscall sf::TcpSocket::connect(class sf::IpAddress const &,unsigned short,class sf::Time)" (__imp_?connect@TcpSocket@sf@@QAE?AW4Status@Socket@2@ABVIpAddress@2@GVTime@2@@Z) E:\Projectos\C++\TestConn\TestConn\TestConn.obj TestConn
Error   3       error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Time const sf::Time::Zero" (__imp_?Zero@Time@sf@@2V12@B)      E:\Projectos\C++\TestConn\TestConn\TestConn.obj TestConn
Error   5       error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::TcpSocket::~TcpSocket(void)" (__imp_??1TcpSocket@sf@@UAE@XZ)    E:\Projectos\C++\TestConn\TestConn\TestConn.obj TestConn
 

But when I link the -d suffix ones and copy the dlls to my exe path it works fine, the problem comes when trying to link dinamically.

Any Advice? thanks in advance.  :)


 

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #1 on: August 13, 2014, 12:05:47 pm »
Well... don't use SFML 2.1 for VS2012 on VS2013, obviously.
If you want to use SFML for VS2013 you'll have to build it yourself or download an unofficial build for VS2013 (you might want to search the forums to find that).

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #2 on: August 14, 2014, 01:17:39 am »


After testing with this unofficial build for VS2013

http://en.sfml-dev.org/forums/index.php?topic=13010.0

I am having exactly the same error as with VS2012 build i felt it was something else so i decided to create this post.

so after that i backed to the 2012 files since it was oficial.

Its a very simple project all i want is to make a connection.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: VS2013 unable to staically link the library "Network"
« Reply #3 on: August 14, 2014, 01:33:08 am »
Instead of trying a combination that is not supposed to work, you should really just come directly to the forum.

When you are ready to try using the proper (VS2013) library with your IDE, post the errors you get here and I'm sure you will find a solution. There aren't that many new problems left for us to discover.
« Last Edit: August 14, 2014, 08:43:45 am by binary1248 »
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #4 on: August 14, 2014, 06:25:38 am »
Error   6       error LNK1120: 5 unresolved externals   E:\Projectos\C++ 2013\TestConn\Release\TestConn.exe     TestConn
Error   4       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::IpAddress::IpAddress(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0IpAddress@sf@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)  E:\Projectos\C++ 2013\TestConn\TestConn\TestConn.obj    TestConn
Error   2       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::TcpSocket::TcpSocket(void)" (__imp_??0TcpSocket@sf@@QAE@XZ)     E:\Projectos\C++ 2013\TestConn\TestConn\TestConn.obj    TestConn
Error   1       error LNK2001: unresolved external symbol "__declspec(dllimport) public: enum sf::Socket::Status __thiscall sf::TcpSocket::connect(class sf::IpAddress const &,unsigned short,class sf::Time)" (__imp_?connect@TcpSocket@sf@@QAE?AW4Status@Socket@2@ABVIpAddress@2@GVTime@2@@Z) E:\Projectos\C++ 2013\TestConn\TestConn\TestConn.obj    TestConn
Error   3       error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Time const sf::Time::Zero" (__imp_?Zero@Time@sf@@2V12@B)      E:\Projectos\C++ 2013\TestConn\TestConn\TestConn.obj    TestConn
Error   5       error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::TcpSocket::~TcpSocket(void)" (__imp_??1TcpSocket@sf@@UAE@XZ)    E:\Projectos\C++ 2013\TestConn\TestConn\TestConn.obj    TestConn
 

These are the linking errors using the  unoficial build http://en.sfml-dev.org/forums/index.php?topic=13010.0 for VS2013

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: VS2013 unable to staically link the library "Network"
« Reply #5 on: August 14, 2014, 08:47:46 am »
SFML_STATIC defined?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #6 on: August 14, 2014, 10:04:18 pm »
#define SFML_STATIC

You can see it in my first post does it work that way? or should I define it in another way?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: VS2013 unable to staically link the library "Network"
« Reply #7 on: August 14, 2014, 10:27:16 pm »
You can see it in my first post does it work that way? or should I define it in another way?
Well, what does the tutorial say? ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #8 on: August 15, 2014, 02:39:10 am »
thx exploiter you were right, i had the wrong idea that defining it #define SFML_STATIC this way would do the samething since defines are procesed at preprocesor level.

Also i ve had some issues adding libs by pragma comment like this:

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

 im new to VS2013 i used to work on vc6 for unmanaged c++.

I defined SFML_STATIC  and now it gives this errors it feels like its asking for

ws2_32.lib

Error   56      error LNK1120: 21 unresolved externals  E:\Projectos\C++ 2013\TestConn\Release\TestConn.exe     TestConn
Error   51      error LNK2001: unresolved external symbol __imp__closesocket@4  E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   25      error LNK2001: unresolved external symbol __imp__connect@12     E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   26      error LNK2001: unresolved external symbol __imp__connect@12     E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   47      error LNK2001: unresolved external symbol __imp__freeaddrinfo@4 E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   46      error LNK2001: unresolved external symbol __imp__getaddrinfo@16 E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   27      error LNK2001: unresolved external symbol __imp__getpeername@12 E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   28      error LNK2001: unresolved external symbol __imp__getsockname@12 E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   29      error LNK2001: unresolved external symbol __imp__getsockname@12 E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   30      error LNK2001: unresolved external symbol __imp__htonl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   31      error LNK2001: unresolved external symbol __imp__htonl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   32      error LNK2001: unresolved external symbol __imp__htonl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Packet.obj)  TestConn
Error   33      error LNK2001: unresolved external symbol __imp__htonl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   49      error LNK2001: unresolved external symbol __imp__htons@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Packet.obj)  TestConn
Error   50      error LNK2001: unresolved external symbol __imp__htons@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   42      error LNK2001: unresolved external symbol __imp__inet_addr@4    E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   43      error LNK2001: unresolved external symbol __imp__inet_ntoa@4    E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   52      error LNK2001: unresolved external symbol __imp__ioctlsocket@12 E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   34      error LNK2001: unresolved external symbol __imp__ntohl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   35      error LNK2001: unresolved external symbol __imp__ntohl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   36      error LNK2001: unresolved external symbol __imp__ntohl@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Packet.obj)  TestConn
Error   37      error LNK2001: unresolved external symbol __imp__ntohs@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   38      error LNK2001: unresolved external symbol __imp__ntohs@4        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Packet.obj)  TestConn
Error   39      error LNK2001: unresolved external symbol __imp__recv@16        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   40      error LNK2001: unresolved external symbol __imp__select@20      E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   41      error LNK2001: unresolved external symbol __imp__send@16        E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   48      error LNK2001: unresolved external symbol __imp__setsockopt@20  E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Socket.obj)  TestConn
Error   44      error LNK2001: unresolved external symbol __imp__socket@12      E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   45      error LNK2001: unresolved external symbol __imp__socket@12      E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Socket.obj)  TestConn
Error   54      error LNK2001: unresolved external symbol __imp__WSACleanup@0   E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   55      error LNK2001: unresolved external symbol __imp__WSAGetLastError@0      E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   53      error LNK2001: unresolved external symbol __imp__WSAStartup@8   E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   21      error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   22      error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   19      error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   20      error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   2       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   3       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   4       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Socket.obj)  TestConn
Error   5       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Packet.obj)  TestConn
Error   6       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   7       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Http.obj)    TestConn
Error   8       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-system-s.lib(Err.obj)      TestConn
Error   9       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-system-s.lib(String.obj)   TestConn
Error   10      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(locale0.obj)        TestConn
Error   11      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(ios.obj)    TestConn
Error   12      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(iosptrs.obj)        TestConn
Error   13      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(locale.obj) TestConn
Error   14      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xlock.obj)  TestConn
Error   15      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xthrow.obj) TestConn
Error   16      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(wlocale.obj)        TestConn
Error   17      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xlocale.obj)        TestConn
Error   18      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xdateord.obj)       TestConn
Warning 1       warning C4005: 'SFML_STATIC' : macro redefinition       E:\Projectos\C++ 2013\TestConn\TestConn\TestConn.cpp    13      1       TestConn
Warning 24      warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library        E:\Projectos\C++ 2013\TestConn\TestConn\LINK    TestConn
Warning 23      warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library        E:\Projectos\C++ 2013\TestConn\TestConn\LINK    TestConn


Thx for your time.
« Last Edit: August 15, 2014, 02:43:38 am by alphadan »

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #9 on: August 15, 2014, 02:49:40 am »
After adding Ws2_32.lib to the library this errors more redefinitions... how do i fix this?  :-\ :-\

Error   24      error LNK1169: one or more multiply defined symbols found       E:\Projectos\C++ 2013\TestConn\Release\TestConn.exe     TestConn
Error   20      error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   21      error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   18      error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   19      error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)      E:\Projectos\C++ 2013\TestConn\TestConn\LIBCMT.lib(crt0init.obj)        TestConn
Error   1       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(TcpSocket.obj)       TestConn
Error   2       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(IpAddress.obj)       TestConn
Error   3       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Socket.obj)  TestConn
Error   4       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Packet.obj)  TestConn
Error   5       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(SocketImpl.obj)      TestConn
Error   6       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-network-s.lib(Http.obj)    TestConn
Error   7       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-system-s.lib(Err.obj)      TestConn
Error   8       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\sfml-system-s.lib(String.obj)   TestConn
Error   9       error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(locale0.obj)        TestConn
Error   10      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(ios.obj)    TestConn
Error   11      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(iosptrs.obj)        TestConn
Error   12      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(locale.obj) TestConn
Error   13      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xlock.obj)  TestConn
Error   14      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xthrow.obj) TestConn
Error   15      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(wlocale.obj)        TestConn
Error   16      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xlocale.obj)        TestConn
Error   17      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj E:\Projectos\C++ 2013\TestConn\TestConn\libcpmt.lib(xdateord.obj)       TestConn
Warning 23      warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library        E:\Projectos\C++ 2013\TestConn\TestConn\LINK    TestConn
Warning 22      warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library        E:\Projectos\C++ 2013\TestConn\TestConn\LINK    TestConn
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: VS2013 unable to staically link the library "Network"
« Reply #10 on: August 15, 2014, 08:08:29 am »
You should not link with pragma comment, again what does the tutorial say? ;)

For linking dependencies things havd changed after SFML 2.1, as such this information is still missing in the tutorial, but can be found in the FAQ: https://github.com/SFML/SFML/wiki/FAQ#wiki-build-link-static

As for your last error, it seems that yoi have a runtime library missmatch. SFML has to be compiled woth /MT (static runtime lib) as well as your application.

If there are more issues, please provide the full build command: http://en.sfml-dev.org/forums/index.php?topic=12552.0
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

alphadan

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: VS2013 unable to staically link the library "Network"
« Reply #11 on: August 16, 2014, 12:30:02 am »
1>------ Build started: Project: TestConn, Configuration: Release Win32 ------
1>  TestConn.cpp
1>  Microsoft (R) Incremental Linker Version 12.00.21005.1
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1>  
1>  "/OUT:E:\Projectos\C++ 2013\TestConn\Release\TestConn.exe" /INCREMENTAL:NO "/LIBPATH:E:\Projectos\Libs\SFML-2.1\Staitc Libs" "sfml-network-s.lib" "sfml-system-s.lib" Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG "/PDB:E:\Projectos\C++ 2013\TestConn\Release\TestConn.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:E:\Projectos\C++ 2013\TestConn\Release\TestConn.lib" /MACHINE:X86 /SAFESEH Release\TestConn.obj
1>  Release\stdafx.obj
1>sfml-network-s.lib(TcpSocket.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-network-s.lib(IpAddress.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-network-s.lib(Socket.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-network-s.lib(Packet.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-network-s.lib(SocketImpl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-network-s.lib(Http.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-system-s.lib(Err.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>sfml-system-s.lib(String.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(locale0.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(ios.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(iosptrs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(locale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(xlock.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(xthrow.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(wlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(xlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>libcpmt.lib(xdateord.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in TestConn.obj
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>E:\Projectos\C++ 2013\TestConn\Release\TestConn.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Again thax for your time, and may you send me a link about those good and bad practices?

Im the kind of person that refuses to follow instructions when I do not know the reason, I really tought that adding the library by pragma comment would have the exact same effect than adding it in project proerties, in fact in vc6 it made no difference from what i know.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: VS2013 unable to staically link the library "Network"
« Reply #12 on: August 16, 2014, 02:22:56 am »
Again thax for your time, and may you send me a link about those good and bad practices?

Im the kind of person that refuses to follow instructions when I do not know the reason, I really tought that adding the library by pragma comment would have the exact same effect than adding it in project proerties, in fact in vc6 it made no difference from what i know.
If you had taken the time (5min I would guess) to look it up, you'd have found that "#pragma ..." is not standardized and thus is not supported by all compilers on all platforms (not even by all compilers on the same platform).
Thus it is a pretty bad solution.

Maybe in the future you should try to (and this is not just related to #pragma link stuff); either follow instructions or do your own research properly...

 

anything