- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very noob question here:
When I #include "tbb\spin_mutex.h" into my header file, i get a whole flood of unhelpful C++ related errors that make very little sense (the C++ compiler very rarely emits useful errors). Commenting it out fixes the problem. I am loading "tbb\tbb_stddef.h" right before "tbb\spin_mutex.h"
I'm using the Intel C++ Compiler 11.0.066 IA32-target on a x64 Windows Vista System.
Very odd, any thoughts before I start going through line-by-line?
When I #include "tbb\spin_mutex.h" into my header file, i get a whole flood of unhelpful C++ related errors that make very little sense (the C++ compiler very rarely emits useful errors). Commenting it out fixes the problem. I am loading "tbb\tbb_stddef.h" right before "tbb\spin_mutex.h"
I'm using the Intel C++ Compiler 11.0.066 IA32-target on a x64 Windows Vista System.
Very odd, any thoughts before I start going through line-by-line?
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Oren
When I #include "tbbspin_mutex.h" into my header file, i get a whole flood of unhelpful C++ related errors that make very little sense (the C++ compiler very rarely emits useful errors). Commenting it out fixes the problem. I am loading "tbbtbb_stddef.h" right before "tbbspin_mutex.h"
I'm using the Intel C++ Compiler 11.0.066 IA32-target on a x64 Windows Vista System.
Very odd, any thoughts before I start going through line-by-line?
I'm using the Intel C++ Compiler 11.0.066 IA32-target on a x64 Windows Vista System.
Very odd, any thoughts before I start going through line-by-line?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Oren,
I tried to re-create your environemnt and build TBB. I opended VS 2008 x32 (not x64_32) and set paths to point to icl 11.0.066 ia32 (...cpp/bin/ia32, ...cpp/lib/ia32). When I launched 'gmake', I was able to build TBB and compile all test programs without any trouble. Could you show us what your build environment look like? The difference between yours and mine may have played a role inyour seeing so many error messages?
-wooyoung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Wooyoung Kim (Intel)
Hi, Oren,
I tried to re-create your environemnt and build TBB. I opended VS 2008 x32 (not x64_32) and set paths to point to icl 11.0.066 ia32 (...cpp/bin/ia32, ...cpp/lib/ia32). When I launched 'gmake', I was able to build TBB and compile all test programs without any trouble. Could you show us what your build environment look like? The difference between yours and mine may have played a role inyour seeing so many error messages?
-wooyoung
The problem was that I have the following functions defined in a header:
template
T max(const vector
template
T max(const T&, const T&)
Where apparently tbb_stddef.h did
#define max(a,b) ( (a) > (b) ? (a) : (b) )
which confused the hell out of my compiler (preprocessor definition tend to do that!) in a way that did not emit a useful error message. I changed my function names to Max and that fixed it.
This is clearly my fault for not have my own namespace and for using such a generic name.
Thanks for you attention, sorry to waste your time on such a triviality.
Oren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I bet neither tbb_stddef.h nor other public TBB header define such a macro as max. We use rather strict rules for macro names, and this one would never flow through code review. More likely, it was included with some standard header used in TBB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Alexey Kukanov (Intel)
I bet neither tbb_stddef.h nor other public TBB header define such a macro as max. We use rather strict rules for macro names, and this one would never flow through code review. More likely, it was included with some standard header used in TBB.
My sincere apologies for the unintended slur. I should have been more clear. It wasn't defined before I included tbb_stddef.h and then it was defined afterwards.
Oren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Oren
My sincere apologies for the unintended slur. I should have been more clear. It wasn't defined before I included tbb_stddef.h and then it was defined afterwards.
Oren
Oren Ijustgrep'd the source/headers and there is a singleoccurrenceof the word max in all of tbb's headers, and it was a size_t max, everything else was along the lines of max_size or some other long-winded name. Which means tbb isn't doing #define max(). Thus the culprit has to be somewhere else in your code base, maybe one of your co-workers added it to one of their source files at the same time you included tbb, or what not.
Or as Alexey points out its probably in a standard header.
But I doubt Intel's compiler or Microsoft's standard header would have a #define max.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - robert.jay.gould
Oren Ijustgrep'd the source/headers and there is a singleoccurrenceof the word max in all of tbb's headers, and it was a size_t max, everything else was along the lines of max_size or some other long-winded name. Which means tbb isn't doing #define max(). Thus the culprit has to be somewhere else in your code base, maybe one of your co-workers added it to one of their source files at the same time you included tbb, or what not.
Or as Alexey points out its probably in a standard header.
But I doubt Intel's compiler or Microsoft's standard header would have a #define max.
Think again about Microsoft. Line 190 of windef.h (%Program Files%Microsoft SDKsWindowsv6.0AInclude):
[cpp]#ifndef NOMINMAX #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #endif /* NOMINMAX */[/cpp]
The tbb headers (mutex.h, tbb_thread.h, tick_count.h and a few others) include windows.h, which includes windef.h (line 155).
Oren
PS. As an aside, I find it a bit disturbing that you blame my coworkers when my original post states that simply commenting out the tbb includes fixes the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Oren
Think again about Microsoft. Line 190 of windef.h (%Program Files%Microsoft SDKsWindowsv6.0AInclude):
[cpp]#ifndef NOMINMAX #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #endif /* NOMINMAX */[/cpp]
So this means TBB should defineNOMINMAX when building on Windows. Anyways I'm amazed Windows.h is written like it was the early 1990's (probably was and never changed...).

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page