Another advice,
Even for conditional it can be reduced to the minimum.
I for example, usually have a common header file, then separate
implementation
files and let make take care of the conditional compilation. This applies to
both C and C++.
As an example,
my_module.h
my_module.c
my_module_win32.c
my_module_linux.c
my_module_bsd.c
This is way lot better than having your source code full with #ifdef …
Again, this is a personal preference, does not mean it is the only way to do
it.–
Paulo
On Mon, Feb 21, 2011 at 4:45 PM, Brian Barrett <brian.ripoff at gmail.com>wrote:
For future reference, the preprocessor can be generally reserved for
conditional compilation. In pretty much all other cases C++ offers
superior alternatives. In this specific case, a typedef might have
worked. If you wanted to add a constructor and destructor, then you
have to properly wrap the SDL_Mixer API.
The language simply doesn’t work the way you wanted it to. As Jonathan
suggests, you might be better off to spend some time learning how to
use the language. This issue has nothing to do with SDL, it just
happened to manifest itself that way (C++ is like that sometimes).
While one is learning the language, any compile/link time errors one
has are almost certainly programmer mistakes rather than issues with
an API. There are general programming forums or mailing lists to which
you can submit such questions. Runtime errors will be mostly
programmer mistakes, but you might need hints from the specific
community to help point out where you are going wrong. Forums such as
http://www.gamedev.net (among others) can be used as a first port of
call to avoid going to the mailing lists with generic questions.
It isn’t that your questions aren’t welcome here, quite the opposite!
But this is the convention which tries to keep niche
questions/knowledge in the project specific lists/forums and generic
questions(and the associated answers) in the larger, more general and
easily searched programming communities. You may also want to read up
on how to ask smart questions
(http://www.catb.org/~esr/faqs/smart-questions.html), which can act as
a guide as well as honing your problem solving skills (both for
yourself and for when you interact with the communities).
On 21 February 2011 15:28, Altair Linux wrote:
I think I find the error, my error.
In a previus version, I make a very short and simple demo with sdl_mixer,
only for testing some params. I write this:
#define Mix_Music ngl_sound
THIS cause the error.
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org