Skip to main content
GameDev.net gamedev.net
🔒 Locked

Preprocessor Macro Problem

Started by _the_phantom_ Jan 22, 2006 at 1:09 PM 2 replies 750+ views
Original Post
_the_phantom_
_the_phantom_
I'm currently in the process of porting my GTL to linux-arm, however I've currently hit a slight problem with the build process on the last few errors. The error I get out is;
Quote:
1>In file included from ..\..\src\/Filters/filters.hpp:9, 1> from ..\..\src\GameTextureLoader.cpp(28): 1>..\..\src\/Filters/BitmapFilter.hpp(182):1: error: pasting "FilterRegister_MakeBitmapFilter" and "(" does not give a valid preprocessing token
However, I'm not sure where the problem lies as this compiles fine with VC7.1/VC8, its the GCC stuff which is throwing the error at me. The Macro in question is

#define DECLARE_TEXTURE_LOADER( idnum, loaderName, callbackFunction ) 
	static FilterRegister FilterRegister_##callbackFunction##( idnum, loaderName, callbackFunction );
and is used thusly;

filterptr MakeBitmapFilter(LoaderImgData_t &imgdata)
{
	return filterptr(new bitmapfilter(imgdata));
}

DECLARE_TEXTURE_LOADER(TYPE_BMP, "BMP",MakeBitmapFilter)
where TYPE_BMP is a const int. Any one got any clues as to how I can fix this issue?
Sneftel
Sneftel
Why do you have a second token-pasting operator after callbackFunction?

EDIT:
#define FOOIFY(x)  foo##x()FOOIFY(bar); // calls foobar()
_the_phantom_
_the_phantom_
and thus the gaps in my knowledge are exposed [grin]
Blame the Source SDK which I pulled the macro from [wink]

Thanks, it all compiles now, yay! [grin]
Shannon Barber
Shannon Barber
You should report that as a defect to the MSVC team.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.