* Ossama Othman: > Something like the following should be a good smoke test: > > class Foo > { > public: > Foo (void) : bar_ (0) { } > virtual ~Foo (void) { } > virtual int bar (void) { return this->bar_; } > private: > int bar_; > }; > > int main (int, char *[]) > { > Foo fnord; > int a = fnord.bar (); > return a; > } * Olly Betts: > Just noticed a problem with this. If you compile it with: > > gcc -o test test.cc > > You get a working executable called test. The reason for this is that gcc automatically goes into C++ "mode" when it sees the .cc extension. You need to call gcc with the "-x" option to explicitly set it to be "C only": $ gcc -x c -o test test.cc will yield test.cc:1: parse error before `Foo' test.cc:2: syntax error before `{' test.cc:6: syntax error before `int' test.cc: In function `bar': test.cc:6: `this' undeclared (first use in this function) [snip] BTW, I second Ossama's arguments for not using a library function. The C++ test code looks good to me. Regards, Morten
- Re: How to optionally test for a C++ compiler? Olly Betts
- Re: How to optionally test for a C++ compiler? Ossama Othman
- Re: How to optionally test for a C++ compiler? Akim Demaille
- Re: How to optionally test for a C++ compiler? Earnie Boyd
- Re: How to optionally test for a C++ compiler? Olly Betts
- Re: How to optionally test for a C++ compiler? Ossama Othman
- Re: How to optionally test for a C++ compiler? Olly Betts
- Re: How to optionally test for a C++ compiler? Ossama Othman
- Re: How to optionally test for a C++ compiler? Morten Eriksen
- Re: How to optionally test for a C++ compiler? Alexandre Oliva
- Re: How to optionally test for a C++ compiler? Ossama Othman
- Re: How to optionally test for a C++ compiler... Alexandre Oliva
- Re: How to optionally test for a C++ comp... Ossama Othman
- Re: How to optionally test for a C++... Alexandre Oliva
- Re: How to optionally test for a... Ossama Othman
- Re: How to optionally test for a C++ compiler? Alexandre Oliva
- Re: How to optionally test for a C++ compiler? Akim Demaille