Hi,
I am trying to use BOOST threads with SDL.
I write a code and run, but the program does not run correctly(i.e i cannot move the output window and i have to force terminate it.)
Also during compilation a warning is given as:

1>LINK : E:\Program Files\src\threading\example\Debug\example.exe not found or not built by the last incremental link; performing full link
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library[\b]

Also I am not sure how to synchronise the sdl events with threads.
Are there things i need to take care of?

Recommended Answers

All 11 Replies

Since it seems you are beginning in Boost, I may well suggest you check POCO. It is said that they are simple though haven't used them, nor boost

If POCO is easier than BOOST(for threading, i sure will try it.
And please help me find the tutorials, I will google those myself anyways.
But thanks for the suggestions.
My main target is to make a game which includes OPENGL as well threading.
I am not familiar with windows programming so i am choosing SDL as I have tried many things with it. Will POCO be ok for me to use with OPenGL + SDL.

Your build of the boost-thread library appears to be broken; built without MT support. MSVCRT and MSVCRTD are the single-threaded runtime libraries, you should not link to one of these libraries in any program that uses threads of any kind - native, Boost, POCO, ACE, wxWidgets, whatever.

Either use Boost.Build to rebuild the binary libraries correctly. Or download and install pre-built boost binaries for Windows by running this setup program from BoostPro http://www.boostpro.com/download/boost_1_44_setup.exe

> If POCO is easier than BOOST(for threading, i sure will try it.

POCO and Boost address different audiences. Boost gives general functionality that could conceivably be part of a standard library with flexibility and performance as overriding design goals. POCO is much more like ACE - more of a framework library giving you readily usable components (akin to the Java/J2EE library) with the attendant cost of having more dependencies between parts; it's more of a heavyweight 'all or nothing' library with higher run-time overheads.

Both ACE and POCO tend to use far less bleeding edge features of C++ than Boost - unlike with Boost, you don't have to be a C++/template guru to understand the source code for either of these. ACE is more mature and robust, but is somewhat dated in its coding style. POCO source code is very well written - quite easy to read and understand even for a beginner in C++.

If I just wanted a library for portable threading with some ipc mechanisms, I would use Boost threads with Boost asio. If I also wanted support for running network-based applications with assorted network protocols, authentication, xml, active objects and so on, I would use either ACE or POCO.

If POCO is easier than BOOST(for threading, i sure will try it.
And please help me find the tutorials, I will google those myself anyways.
But thanks for the suggestions.
My main target is to make a game which includes OPENGL as well threading.
I am not familiar with windows programming so i am choosing SDL as I have tried many things with it. Will POCO be ok for me to use with OPenGL + SDL.

As said earlier, POCO have threading library. You can read their docs online or download them at their site

I downloaded the POCO library(poco 1.3.6p2). But the lib folder is not included there? Should i do sth to make it or is my download incomplete?

Which os are you in?
You have to uild it and is very simple and documented in Download page.
Here I quote from them

Please see the included README file for instructions.

On Unix platforms, you'll be fine with ./configure; make.
For Windows users, Visual C++ project files and build scripts are included.

You can exclude some libraries from the build.

On Windows, edit the file named components and remove the lines corresponding to the libraries you wish to exclude.
On Linux, call the configure script with the --omit option, e.g.
./configure --omit=NetSSL_OpenSSL,Crypto or ./configure --omit=Data.

If you are on windows, see Franky's script
Remember to download premake file and drop it in POCO. You can do it via MSYS/MINGW or using already provide CMD files if you use VC++

I can post you CodeLite Projects for the whole thing if you want

I am using windows 7. I am using VC++ 2008.
As said in the README i ran the buildwin.cmd(90) script from the command prompt of vc++. I dont think anything happened. what is to be done?

I now built the library(Foundation_vs90) from the vc++ (build -> build batch -> select all -> rebuild)
while building it says

I have hereby attached the log of the build.

it says at the end that:
========= Rebuild All: 4 succeeded, 10 failed, 0 skipped ==========

Good Advice is to download CodeLite and get premake4. Then follow previous post and build it with Codelite projects. Only set project compiler as VC++ instead of g++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.