- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to use the __INCLUDE_LEVEL__ preprocessor macro with the 9.1 c++ compiler for windows but it seems it's not supported, not in msvc either. Is there any way to get it to work?
Thanks
#include
using namespace std;
int main()
{
cout << __INCLUDE_LEVEL__ << endl;
}
error: identifier "__INCLUDE_LEVEL__" is undefined
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I can tell, __INCLUDE_LEVEL__ is a gcc extension(http://www.mhatt.aps.anl.gov/dohn/programming/gcc/cpp_3.htmlsection 3.7.2) and thus it's not likely that you'd find support for it on Windows, except with gcc.
That being said, it appears that icc doesn't have support for it even on Linux. I can file an issue on that, but I'm not sure that will help your case on Windows.
Just out of curiosity, how crucial is this to your code? And how are you using it?
Thanks!
Dale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
//-------file main.c----------
#include
int main()
{
#define REP_LIMIT 10
#define REP(BLAH)
printf("%d ", BLAH);
#include "rep.h"
return 0;
}
//--------file rep.h----------
#if __INCLUDE_LEVEL__ < REP_LIMIT
REP(__INCLUDE_LEVEL__)
#include "rep.h"
#endif
It's not very useful here, but together whth the ## preprocessor operator it could be used when dealing with multiple numbered variables (e.g. foo1, foo2, foo3 etc)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Roll your own. Suggestion:
-------file main.c----------
#include
int main()
{
#define REP_LEVEL 0
#define REP_LIMIT 10
#define REP(BLAH)
printf("%d
", BLAH);
#include "rep.h"
return 0;
}
//--------file rep.h----------
#define NEXT_REP_LEVEL (REP_LEVEL+1)
#define REP_LEVEL NEXT_REP_LEVEL
#if REP_LEVEL < REP_LIMIT
REP(REP_LEVEL)
#include "rep.h"
#endif
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page