Building Poco on Windows

Tips and tricks for POCO C++ Libraries users.
robini
Posts: 1
Joined: 08 Dec 2011, 18:33

Building Poco on Windows

Postby robini » 08 Dec 2011, 18:55

I wasted a lot of time building Poco on Windows using the TCC LE command prompt (V12.11).

I tried to build the libraries using

Code: Select all

buildwin 90 build all both Win32 samples
. Under TCC this will only build the shared debug libraries as the subsequent ones don't get built.
It looks like the TCC batch file interpreter can not parse multiple ifs in a for loop.

The standard windows command prompt works just fine!

Also the "nosamples" flag does not work either use "no" or edit buildwin.cmd

before (line: 272)

Code: Select all

if "%SAMPLES%"=="no" goto :EOF


after

Code: Select all

if "%SAMPLES%"=="nosamples" goto :EOF


Hope this is of help

Robin

braithwa
Posts: 1
Joined: 06 Jul 2016, 12:21

Re: Building Poco on Windows

Postby braithwa » 06 Jul 2016, 12:27

I am a Linux user and was completely stumped when I tried to port my project to Windows.
The following may well be helpful to someone else.

* If you are a Nix user, then installing Msys2 will make life easier.
Some of the hints in these instructions assume it.
* Msys2 is an entire Unix command line environment.
* The command pacman -S <package name> is used to install useful
stuff into your environment.

* Sadly, as the Poco README file proclaimed minGw could not compile poco
1.7.3 on my Windows PC. What a shame, because if that has worked
things would have been much easier. Instead, the following is what
worked for me.

Building Poco
-------------

* Install the MS Vis Studio community 2015 version with C++. (herafter
referred to as VC++.) If that is old, then these instructions may
well be out of date.

* Download and Install SSL libraries on windows as per poco dir README
file. Otherwise the build may not fully succeed.

* Download and unzip a fresh POCO distribution. It might be bad to
have old object files of the wrong type hanging around.

* Get VC++ command prompt (it has the right environment vars set up etc.)
* Change directory to the base of the poco source dir.
* Use command build_vs140.cmd
* Use defaults unless for good reason.
* Hopefully the samples will compile. You may need them.

* Test using one of the provided samples in the Poco dir. Choose one
that is the closest fit for your actual project. If the samples
dont work, neither will your code, so dont proceed if the sample
does not work.


Installing Poco
---------------

* Copy include files to chosen include dir
* because /usr/local/include might not be right for windows.
* Using msys2 command prompt:-
* cd <include dir>; inc=$(pwd) ;
* cd <poco base dir>
* cd Foundation/include; cp -r Poco $inc; cd ..
* cd Util/include; cp -r Poco $inc; cd ..
* cd JSON/include; cp -r Poco $inc; cd ..
* cd XML/include; cp -r Poco $inc; cd ..
* cd Net/include; cp -r Poco $inc; cd ..

* Copy results (.lib etc) to chosen lib dir
* because /usr/local/lib might not be right for windows.

* Copy results (dll etc) to chosen dir
* You probably need to create own dir because you wont have
permission even as administrator to put in /windows/system32.
* Add that dir to the PATH environment variable so that
executables can find the libraries.

* Copy chosen sample project out from Poco dir and compile with the
IDE by opening the file "*.vxcproj" in the sample dir.
* Build : Rebuild solution
Make sure this works.

Set up your project
-------------------

* Copy project from chosen sample into source code of new project. This
will become the project file for your new project. If you make a
brand new project, it might not link with your Poco library unless
you do everything right. I did everything wrong and hammered at it
for a day with naught to show for my effort.

* Using the IDE, remove sample source code from the project and
replace with own source code.
* It is sufficient to add .cpp files to the project.

* Using the IDE, add the chosen include directory (for the poco header
files) into the project properties.
* project : properties : C/C++ : General : Additional Include Dirs

* Using the IDE, add the chosen library directory (poco .lib etc) to
the project properties.
* project : properties : Linker : General : Additional Library Dirs
* (also target file while you are there)

* Give your project directory a subdir for object code and for
executables. This is just keeps them out of the way.
* Add your object dir to the the project.
* project : General : Intermediate Dir

* Edit project file using a text editor and replace references to
original sample project with name of new project.

zosrothko
Posts: 30
Joined: 08 Aug 2014, 20:29
Location: Lille, France
Contact:

Re: Building Poco on Windows

Postby zosrothko » 20 Aug 2016, 23:09

Poco does not officially support mingw, but contributions are encouraged.

By the way, the Cygwin platform both 32 and 64 bits are supported. So it is worthwhile to notice, this could help Unix users to port their Poco applications on WIndows knowing that Cygwin is not Linux.

See https://www.cygwin.com/ for what is and is not Cygwin.


Return to “Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest

cron