How to Set Up POCO C++ Libraries with Visual Studio 2010

I decided I would road-test the C++ framework “POCO” to see if it is worthwhile.
Setting up was a bit of a mission and took me around 2.5 hours to achieve. Here’s how I went about it:

  1. navigate to the POCO downloads page and download the basic edition sources for Windows
  2. extract it to a folder. For me, it was D:\poco-1.4.6 (“the POCO base directory”)
  3. open a Visual Studio Command Window from the Visual Studio Tools folder in your start menu.
  4. change directories to the POCO base directory and run the buildwin.cmd, passing in the relevant version of Visual Studio. For me, it was buildwin.cmd 100
  5. go make a cup of tea and watch some Youtube for 20 minutes or so
  6. once built, a directory called bin will appear in the POCO base directory. You need to add that directory to the System Environmental Path. If you do not know how to do that, Google it. It’s very easy and many people will blog about how its done. There, I just Googled it for you.
  7. create a new Visual Studio project. I went with a Win32 variety console app.
  8. right-click on the Project node in Solution Explorer and click Properties on the context menu.
  9. in the tree on the left, click on the node >C/C++
  10. in the panel that is loaded on the right, Click the Additional Include Directories TextBox, and using the wizard that launches, add a path to the directory “D:\poco-1.4.6\Foundation\include”. Add any other library you intend to use as well.
  11. in the tree on the left, click on the node >Linker
  12. in the panel that is loaded on the right, Click the Additional Include Directories TextBox, and using the wizard that launches, add a path to the directory “D:\poco-1.4.6\lib”
  13. That’s all the plumbing you need to do. Now, here is a Hello World! to show you how to incorporate it into the Console app:

    #include "stdafx.h"
    #include <Poco/String.h>
    
    using Poco::trim;
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	std::string hello("            Hello, world!          ");
    	std::string s1(trim(hello)); // "Hello, world!"
    	
    	std::cout << s1;
    
    	return 0;
    }
    

I hope this saves someone some time getting up and running with POCO.

  1. This post is great. I really needed a step-by-step guide like this. I’ve already found out in POCO documentation that I have to run buildwin.cmd but couldn’t figure out what directories should be added in which Visual Studio form.
    Now it works 😛 😎 I’d add an extra step to your guide: you have to copy the dll files from poco-1.4.6\bin to the directory where your EXE file is before you run it.
    Also, I think you mean Additional Library Directories instead of Additional Include Directories in step 12.
    Thank you David for this post, you helped me a lot. 🙂

  2. You are most welcome. I’ll check out that correction which you brought to my attention. I probably thought one thing while I was typing another 😕

  3. Hi David.
    How to define the POCO_BASE variable?
    Is it necessary on Windows?

    Tankyou for this tutorial.

    Sergio

  4. Thanks, you are a life saver! I didn’t know I had to add it to PATH as well. My application always crashed with an uninformative error (a really bad habit of Visual Studio).

  5. Excellent basic steps explained in simple way for newcomers of poco thereby saving a lot of efforts.

  6. Thanks a lot for the clear explanation.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>