0

I am trying to link pion network library 4.0.3 in my application. I tried to simply compile pion::netlib in RELEASE_STATIC mode - which worked. However, when I linked against it in my application I get alot of unresolved externals.

Then I found out that RELEASE_STATIC configuration defines PION_STATIC_LINKING, and from another post about another library I found out I probably need to define PION_STATIC_LINKING in my program aswell.

Doing so yields a few 100 errors along the following template:

error LNK2005: _tolower already defined in MSVCRT.lib(MSVCR100.dll) C:\Users\name\Documents\Visual Studio 2010\Projects\myproj\LIBCMT.lib(tolower.obj)  myproj

I tried to use /NODEFAULTLIB:libcmt but I still get errors that say certain functions already defined in pion-common.lib / pion-net.lib.

Any ideas? :(

Neel Basu
  • 12,638
  • 12
  • 82
  • 146
Max
  • 4,345
  • 8
  • 38
  • 64

1 Answers1

2

This could most probably be because you are compiling your project using /MT (Multi-threaded) settings for Code Generation, while pion network library was compiled using /MD (Multi-threaded DLL) or vice-versa. Try changing your configuration to /MD if it's /MT or vice-versa. To do this, go to Project -> <ProjectName> Properties... -> Configuration Properties -> C/C++ -> Code Generation. In the right panel you should be able to see the setting Runtime Library. Change the options there and rebuild your whole solution.

Vite Falcon
  • 6,575
  • 3
  • 30
  • 48
  • Hey thanks, you were quite right! Can you point me towards some buzzword I can google or some article/resource I can read to help me understand the difference between the code generation setting DLL and the "configuration typ" / output setting DLL? – Max May 09 '11 at 14:36
  • 1
    In simple terms, your C++ applications, when distributed to other machines need to have CRT (C Run TIme) libs of the same version you compiled against when you use /MD. However, when you use /MT, the dependent libraries gets statically-linked to your application and hence do not require the target machine to have the CRT installed. More about it in a discussion here: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/cb662a7a-19a6-44f6-9d87-93b05280801b/ – Vite Falcon May 09 '11 at 16:03