Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Missing include

andysem
New Contributor III
525 Views
Hi,
In file src/tbb/tbb_misc.cpp there is a missing #include . The header is required to be able to construct exception objects in this file, since STL exceptions accept std::string in the constructor. Apparently, STLPort defines exception classes without including somehow, which, I believe, is correct in C++. Adding the include fixes compilation with STLPort.
0 Kudos
2 Replies
Alexey-Kukanov
Employee
525 Views
tbb_exception.h contains the following:

#if __SUNPRO_CC
#include // required to construct std exception classes
#endif

This is exactly for the case you described, since we compile with STLPort on SunOS. It seems that the macro guard should be for STLPort, rather than for the compiler. If you tell what would be the right macro to check and save us time to find that out, I would appreciate :)

But in general, I think it's rather a bug in the implementation, even if the standard allows it. Creation of an std::exception-derived object might notuse string explicitly, so why I have to include ?
0 Kudos
andysem
New Contributor III
525 Views
You can test for _STLPORT_VERSION or __SGI_STL_PORT macros, after including something from STL. The latter one, I presume, is defined for older versions of STLPort, so probably the first one would be enough.
Or you can simply always #include . :)
0 Kudos
Reply