Thank you! I did as you suggested (adding boost sources to my project), and it worked!

However, when I tried to do the same with boost-chrono, this error showed up:

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um\combaseapi.h(1189): error C3861: 'CoCreateInstanceFromApp': identifier not found (compiling source file ..\..\BoostSelf\libs\chrono\src\chrono.cpp)

Apparently, it is not necessary for boost-thread to build, but I would certainly like to have access to the chrono classes. The wpbest UWP boost repository (https://github.com/wpbest/Boost) claims that it can be built; are there any other options that I need to set to build boost-chrono?

Best regards,
Petr



2016-12-19 10:29 GMT+01:00 John Maddock <jz.maddock@googlemail.com>:


On 18/12/2016 17:28, Petr Hudeček wrote:
Hello,
I'm trying to use the boost-thread library in a Windows Runtime (UWP) project. The tutorial at https://blogs.msdn.microsoft.com/vcblog/2014/07/18/using-boost-libraries-in-windows-store-and-phone-applications/ doesn't seem to work anymore.

If I compile boost sources, either from the primary distribution, or from https://github.com/wpbest/Boost, I can compile it as a static library but when I link to it from the project, I receive linker errors that four identifiers could not be found. These identifiers are API functions such as CreateWaitableTimer.

Is there a way to use boost-thread from a UWP project despite this? Perhaps setting some preprocessor symbols?

Looks like Boost.Thread uses BOOST_PLAT_WINDOWS_RUNTIME for this, which is set by Predef according to the value of WINAPI_FAMILY - so if I'm reading this correctly, you shouldn't get those errors if the library really is compiled against the universal runtime.

BTW if I was doing this, I would just define BOOST_ALL_NO_LIB and then either:

* Add the thread lib source direct to my app, or
* Add the thread lib source to a static lib project in the IDE and reference it from the apps that need it.

IMO it's easier to keep build options all in synch this way.... but that's just me.

HTH, John.

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users