How to compile boost-thread for Universal Windows?
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-... 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? Thank you, Petr Hudecek
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-... 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.
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
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.c om/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
On 20 December 2016 at 14:00, Petr Hudeček
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.
Just use std::chrono... degski
Le 20/12/2016 à 13:00, Petr Hudeček a écrit :
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)
I don't know how chrono.cpp incudes the file you are showing combaseapi.h, but this is not a Boost file. Could you show the inclusion stack.
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, Vicente
Thank you. I found working compiled libraries elsewhere so I no longer need it to compile. If I encounter this problem again, I'll try to figure out how to show the inclusion stack. Best regards, Petr 2016-12-30 11:48 GMT+01:00 Vicente J. Botet Escriba < vicente.botet@wanadoo.fr>:
Le 20/12/2016 à 13:00, Petr Hudeček a écrit :
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)
I don't know how chrono.cpp incudes the file you are showing combaseapi.h, but this is not a Boost file. Could you show the inclusion stack.
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, Vicente
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
degski
-
John Maddock
-
Petr Hudeček
-
Vicente J. Botet Escriba