help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Porting to g++ on Linux questions


From: Ulrich Eckhardt
Subject: Re: Porting to g++ on Linux questions
Date: Thu, 31 Mar 2005 23:08:43 +0200
User-agent: KNode/0.8.1

Terry wrote:
> Where do I find a list of built-in compiler defines that I can use in my
> program for conditional compilations?
> 
> For example, I use constructs like:
> 
> #if defined(MSC)
>  ....
> #endif
> 
> Or
> #if defined(_DEBUG)
>  ...
> #endif

Try taking a look at existing code, but I'm pretty confident that those
defines are also documented somewhere. About _DEBUG, I can tell you that
you have to define that manually.

> Second, I am having a problem compiling some code.  Basically a base
> template class includes a protected member variable which should be
> available to the templated sub-class, but the compiler generates an error
> that the member does not exist.

Right, and that is because the C++ standard wants it so, and recent
versions of GCC started enforcing it. You must explicitly qualify the
member you want with either 'baseclass::member' or 'this->member'.

> I have even made this member public in the base class, to no avail.  

private/protected/public doesn't matter for that, the first thing is
finding a symbol (and in the case of template classes the base is not
searched) and only then the compiler determines if the symbol is
accessible. That's a topic for comp.lang.c++.moderated though.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]