poco for codeblocks (win)

Hi all.

I managed to compile poco for mingw on windows and it works with my 0.05 cb fat. In case anyone on that platform/editor wants to have a look at poco, you can grab the libs, srcs and dlls here

http://jesusgollonet.com/openFrameworks-…-blocks.zip

To make it work:

1. add the /poco folder to your /libs folder

2. add the relevant dlls to the /bin folder of your app

3. in project/build options/linker settings, add the path to the relevant poco libs:

4. in project/build options/search directories add the path to the poco .h files:

thanks, saved my day!

I thought I would have a look at Poco on codeblocks. I’ve not been following the poco threads on the forum, time for me to catchup.

I have downloaded and followed your instructions.

however in the search direction
…\libs\poco\src there is no files, but a folder called Poco. Inside there are all the files. Were your instructions not quite correct?

If I include #include “Poco.h” it says file not found using the above search path. But #include “Poco/Poco.h” seems to work, although the compiler doesn’t actually seem to try and compile Poco and my filesize gets no bigger.

What else do I need to do to get Poco working with a OFW?

Thanks

Hi Chris,

When you use Poco you always have to include every Poco-file you want to use, like: #include “Poco/Net/HTTPRequest.h”. This makes the header files a bit messy, but Poco seems to use this structure internally, so including “src/Poco/Net/” and then writing #include “HTTPRequest.h” does not help, you still need to include “src/” to actually make the code compile. But if you do find a solution to this, and not having to include every Poco/*.h file i would like to hear about it.

The file size is probably due to the fact that no poco files are actually linked/included if you dont explicitly say so. Maybe it changes if you try to integrate an example that uses 5-6 poco classes?

/cj

Thanks CJ.

I have just realised this after looking through the pachube addons and a webscraper.

I think its good that you only have to include the parts you want, but maybe it should be easier, like the way we define which addons to include:
#define OF_POCO_USING_HTTP
#define OF_POCO_USING_EVENTS
#define OF_POCO_USING_FILEIO

and then a wrapper includes the specifics for you. I guess it depends on what Zach & Theo are doing to include poco into ofw006.

I see in the pachube addon you use Poco::URIStreamOpener and jesus used in webscraper
HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);

Which is the better Poco function to use if you wanted to open an rss feed for example? (only once, not constant stream)

Thanks

Yep, that’s what i think too. To make defines which parts of poco should be available. That shouldn’t be too much work and much easier.

I used the URIStreamOpener since it was only one line of code. Actually i wanted to add POST arguments to the http call, which is supposed to work with HTTPRequest, but i didn’t get it to work. I think you have to understand what to print to the stream once it is open, and i don’t know the HTTP protocol well enough. (If you find a piece of code that does it, with poco, i’d like to see it.) But the did the job just as good when it came to GET arguments. Only thing i found the code easier to read, and less #includes, with URIStreamOpener.

/cj

#define OF_POCO_USING_HTTP
#define OF_POCO_USING_EVENTS
#define OF_POCO_USING_FILEIO

I’m not certain we will head down this route – we will include poco in OF to get access to events and some other functionality for the core. Then, addon developers can pick and choose what they use from poco (and include it however they’d like), but in the core we will include the whole poco distribution. (although, perhaps not with ssl at this point). We don’t for example, include all of the quicktime header files (and they are not all included like ofMain.h does for OF) so I’m not sure why we would do the same for poco… is there a benefit? to unnecessarily include all .h files can lead to issues down the line, I would bet… also having more specific .h file includes can mean you know where to look for certain code.

in terms of linking, most compilers have an option, something like “eliminate dead code” where they don’t link against static libs if they don’t have to - this means all the poco libs are included, but when you make an exe that doesn’t use poco, not parts of the compiled poco lib are linked in (and the file doesn’t get bigger). the 0.06 mac release will have this enabled (was not before) but I believe on the pc both VS and CB seem to do this.

thanks!!
zach

[quote author=“cj”]Actually i wanted to add POST arguments to the http call, which is supposed to work with HTTPRequest, but i didn’t get it to work. I think you have to understand what to print to the stream once it is open, and i don’t know the HTTP protocol well enough. (If you find a piece of code that does it, with poco, i’d like to see it.)
[/quote]

cj, take a look & tell me what you think

http://forum.openframeworks.cc/t/threaded-http-get-and-post-using-poco/1146/0

Hi!

Was just wondering if anyone has compiled poco for VC2008 that works with 0.05 FAT?