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

Errors compiling TBB c++ include file concurrent_vector.h

craigpod
Beginner
952 Views

When I compile concurrent_vector.h in a small isolated windows 11 c++ console test project I don't have a problem. 

I'm using the latest release of Visual Studio Community edition and the latest release on oneAPI.

I'm getting the following error messages when i compile concurrent_vector.h in another application build in which i am trying to use the TBB function

1>C:\Program Files (x86)\Intel\oneAPI\tbb\2021.12\include\oneapi\tbb\concurrent_vector.h(488,21): error C2589: '(': illegal token on right side of '::'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\2021.12\include\oneapi\tbb\concurrent_vector.h(488,16): error C2062: type 'unknown-type' unexpected
1>C:\Program Files (x86)\Intel\oneAPI\tbb\2021.12\include\oneapi\tbb\concurrent_vector.h(488,21): error C2059: syntax error: ')'

 

Here is the include sequence I'm using:

#include <oneapi/tbb.h>
#include <oneapi/tbb/parallel_for.h>
#include <blocked_range.h>
#include <concurrent_vector.h>

 

Please help.  Do i need to include something before concurrent_vector.h

Regards

Craig

0 Kudos
7 Replies
craigpod
Beginner
892 Views

I isolated the problem and found that the errors occur when I include <windows.h> above concurrent_vector.h

I can't remove windows.h from my build because too many other things rely on it.

I attached a cpp file with the code that should reproduce the problem.

Please suggest a work around to resolve this.

Thank you in advance for your help

Craig

0 Kudos
Mark_L_Intel
Moderator
871 Views

@craigpod, this looks like a potential bug. Please file a bug report (including reproducer) at  https://github.com/oneapi-src/oneTBB/issues

0 Kudos
aedls
Beginner
627 Views

Is there any fix or work around of this bug?

In my case, I successfully created a very simple console app that runs without issues. However, when I applied the same include files and basic logic to my sample DLL project, I encountered the following errors.

 

oneTBB version: 2021.13

 

#include <oneapi/tbb.h>
#include <oneapi/tbb/concurrent_vector.h>

 

1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C2589: '(': illegal token on right side of '::'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C3878: syntax error: unexpected token '(' following 'expression'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): message : error recovery skipped: '( ( this . . . identifier'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): message : parsing resumes here
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C2760: syntax error: ')' was unexpected here; expected ';'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C3878: syntax error: unexpected token ')' following 'jump_statement'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): message : error recovery skipped: ') ) <'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): message : error recovery skipped: ') ?'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C2760: syntax error: ':' was unexpected here; expected ';'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): error C3878: syntax error: unexpected token ':' following 'expression_statement'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): message : error recovery skipped: ':'
1>C:\Program Files (x86)\Intel\oneAPI\tbb\latest\include\oneapi\tbb\concurrent_vector.h(488,21): message : error recovery skipped: ')'

0 Kudos
Mark_L_Intel
Moderator
568 Views

@aedls and @craigpod, were you able to file bug report at oneTBB issues

0 Kudos
aedls
Beginner
469 Views
0 Kudos
Mark_L_Intel
Moderator
455 Views

Hello @aedls, thank you for filing a report.    

0 Kudos
aedls
Beginner
370 Views

Thank you Karolina, to fix it you need to define NOMINMAX before including windows.h.

I my case I added this processor directives in my framework.h.

 

#ifndef NOMINMAX
#define NOMINMAX
#endif

 

Answer: concurrent vector compiler errors · Issue #1475 · oneapi-src/oneTBB · GitHub

Explanation: windows.h breaks the standard library (and my will to live) – Belay the C++ (belaycpp.com)

 

0 Kudos
Reply