1

I've done quite a bit of experimentation on this as well as searching. The StackOverflow response at How to add Poco library in Visual Studio 2010? one is close but does not quite solve my problem.

Specifically, I am trying to build an application that will not depend on the Poco DLLs to run. The application runs fine when the DLLs are present.

In Poco's lib directory, libraries are provided for many versions of what is essentially the same library, for example, CppUnit.lib, CppUnitd.lib, CppUnitmd.lib, CppUnitmdd.lib, CppUnitmt.lib, and CppUnitmtd.lib.

It is my understanding that the "...mt" versions of the lib files allow the app to be build monolithically, without requiring the Poco DLLs to be present at runtime. (Is this correct?)

I am using MS Visual Studio 2010, and trying to encourage the linker to use the "...mt" version of each of the Poco libraries (...mtd version for the debug build.)

All of the Poco libraries are in the same directory. I have added that directory path to Preferences>Project>Linker>General>Additional Library Directories, and I have explicitly added CppUnitmt.lib;PocoFoundationmt.lib;PocoNetmt.lib to Preferences>Project>Linker>Input>Additional Dependencies.

The link seems to go without a hitch; the build is successful. Yet when I run my app I get an alert saying: "The app can't start because PocoFoundation.dll is missing from your computer. Try reinstalling the program to fix this problem."

To summarize, my question is: Can a Poco app be build that will not require access to the Poco DLLs, and if so, how do I tell the VS 2010 Linker to do it that way?

Community
  • 1
  • 1
Logicrat
  • 4,438
  • 16
  • 22
  • The letters ("md"/"mt"/etc.) have to match your own project settings in regards to multi-threading and static/dll linking. See e.g. [this page](http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx) for some help. – Some programmer dude Jul 09 '14 at 14:47
  • Joachim, thanks for the link. That certainly does help me understand the linker somewhat better. – Logicrat Jul 09 '14 at 15:45

1 Answers1

1

I've never used Poco, so consider the following assumptions based on my own experience with VS in general (since the linker settings use flags with similar names) as well as other projects.

You misunderstood the "extensions" on the filenames.

Those represent the type of MSVC runtime has been used to build the library (as it should generally match your own project or very, very bad things might happen):

  • CppUnit.lib: This is most likely the static version (is it bigger than the other non-debug libs?). If you use this one, you won't have to use the DLL files.
  • CppUnitd.lib: This is most likely the static debug version.
  • CppUnitmt: This is the library using the multithreaded runtime (i.e. won't need the MSVC runtime files to be installed).
  • CppUnitmtd: This one uses the multithreaded debug runtime.
  • CppUnitmd: This one uses the multithreaded dynamic runtime (therefore the "d").
  • CppUnitmdd: This one uses the multithreaded dynamic debug runtime.
Mario
  • 35,726
  • 5
  • 62
  • 78
  • Mario, thanks for the insights. Unfortunately, the library sizes are not as I had hoped; the ones with neither "mt" nor "md" are by far the smallest, then the "md" version is much bigger, and the "mt" version is slightly bigger than the "md" version. And yes, for sure the single "d" on the end is the debug version. – Logicrat Jul 09 '14 at 16:26
  • That case mt/mtd might be the static ones. How about some trial & error? – Mario Jul 09 '14 at 17:41
  • The /MT switch did it. I had been doing trial/error with the different libs but had not previously modified `Configuration Properties > C/C++ > Code Generation > Runtime Library.` That did what I was looking for. – Logicrat Jul 09 '14 at 21:20