|
From: Per W. <pw...@ia...> - 2004-09-07 06:27:47
|
Some versions of Dev-C++ have had a bit of problem to parse the constantly
varying error messages emitted by the MinGW compiler. This has resulted in
a bit strange errors in the 'Compiler' tab. If switching to the 'Compiler
Log' tab, you should have the full messages.
Too bad that different versions of MinGW gives different error messages :(
The problem parsing the error messages - and also the impossibility of the
Dev-C++ project to keep a list of all gcc error messages can be clearly
seen from the following tests runs with a couple of versions of the MinGW
compiler - all of them separately installed, i.e. not from a Dev-C++
installation package.
gcc 2.95.3-6 gives:
fnkptr.cpp: In function `int main()':
fnkptr.cpp:29: assuming & on `Dog::Speak'
fnkptr.cpp:29: assuming & on `Dog::Move'
fnkptr.cpp:29: assuming & on `Dog::Eat'
fnkptr.cpp:29: assuming & on `Dog::Growl'
fnkptr.cpp:29: assuming & on `Dog::Whimper'
fnkptr.cpp:29: assuming & on `Dog::RollOver'
fnkptr.cpp:29: assuming & on `Dog::PlayDead'
fnkptr.cpp:29: Internal compiler error in `const_hash', at varasm.c:2373
gcc 3.2 (mingw special 20020817-1) gives:
fnkptr.cpp: In function `int main()':
fnkptr.cpp:29: assuming pointer to member `void Dog::Speak() const'
fnkptr.cpp:29: (a pointer to member can only be formed with `&Dog::Speak()
const')
gcc 3.3.3 (mingw special) gives:
fnkptr.cpp: In function `int main()':
fnkptr.cpp:29: error: assuming pointer to member `void Dog::Speak() const'
fnkptr.cpp:29: error: (a pointer to member can only be formed with
`&Dog::Speak
')
gcc 3.4.1 (mingw special) gives:
fnkptr.cpp: In function `int main()':
fnkptr.cpp:22: error: invalid use of non-static member function `void
Dog::Speak() const'
fnkptr.cpp:23: error: invalid use of non-static member function `void
Dog::Move() const'
fnkptr.cpp:24: error: invalid use of non-static member function `void
Dog::Eat() const'
fnkptr.cpp:25: error: invalid use of non-static member function `void
Dog::Growl() const'
fnkptr.cpp:26: error: invalid use of non-static member function `void
Dog::Whimper() const'
fnkptr.cpp:27: error: invalid use of non-static member function `void
Dog::RollOver() const'
fnkptr.cpp:29: error: invalid use of non-static member function `void
Dog::PlayDead() const'
fnkptr.cpp:29: error: invalid use of non-static member function
As can be seen from the above, gcc 3.4.1 is the least helpful, since it is
the only one not suggesting a & before the function names...
/Per W
On Mon, 6 Sep 2004, Roger Furer wrote:
> Aloha from Honolulu,
> Thank You Per, once again you have made my life easier and increased
> my knowledge. Still, I have this question: How did you know what the
> complete error message said? All that comes up in my compiler messages
> is "assuming" on the first line and "(a" on the 2nd. Yes that is an
> open parentesis and a lower case a; and nothing else. I tried copying
> the line and pasting it into a Notebook file and got the same result.
> Where does one find these answers?
> Thanks Again,
> Roger
>
> Per Westermark wrote:
>
> >1) The complete error messages are:
> >fnkptr.cpp:29: error: assuming pointer to member `void Dog::Speak() const'
> >fnkptr.cpp:29: error: (a pointer to member can only be formed with `&Dog::Speak() const')
> >
> >Just add a & before eacn function name, just as the error message suggest,
> >and the compiler will be happy.
> >
> >2) Notice that Dev-C++ is an integrated development environment, not a
> >compiler. It is the gcc team - or possibly the MinGW team - that is
> >responsible for which error messages are emitted by the compiler. By the
> >way, 99.9% if the error messages I have seen have been quite obvious.
> >
> >3) windef.h is a file seldom directly included in a program. However, a
> >number of other include files recursively requests the windef.h file. If
> >you check again, you should be able to find out why the compiler mentioned
> >it. The compiler never makes this kind of mistake. The only reason it said
> >BOOL was already defined in windef.h was that the program directly or
> >indirectly did include windef.h
> >
> >/Per W
> >
> >On Sun, 5 Sep 2004, Roger Furer wrote:
> >
> >
> >
> >>Aloha from Honolulu,
> >> The following was taken from Sams Teach Yourself C++ and refuses to
> >>compile. The compiler reports the error at the line following
> >>"Dog::PlayDead" which is the closing brace and semi-colon for the "PDF
> >>DogFunctions...". I have marked it with an exclamation point ! here.
> >>While I do need to know what the code's problem is, more vexing is that
> >>in the compiler report window under messages is listed "assuming" and on
> >>the next line "(a". Nowhere have I been able to find a list of the
> >>various messages. I looked under the Help window of the program
> >>(Version 4.9.8.0) and also on the Bloodshed site, but no luck there
> >>either. I would suggest that a comprehensive list of error messages
> >>would benefit most everyone using these programs.
> >> A further note: earlier in the lesson was a line: enum BOOL {FALSE,
> >>TRUE}; that generated the folowing error messages: "conflicting" and
> >>then: (copied from the compiler report window)
> >>227 C:\Dev-Cpp\include\windef.h previous declaration as `typedef
> >>WINBOOL BOOL'
> >> My solution was to comment it out, but why did the message appear
> >>when windef.h was never included in the code?
> >>Thanks in advance,
> >>Mahalo,
> >>Roger
> >>
> >>
> >>//Listing 20.10 Array of pointers to member functions
> >>#include <iostream>
> >>class Dog
> >>{
> >> public:
> >> void Speak()const { std::cout << "Woof!\n"; }
> >> void Move() const { std::cout << "Walking to heel...\n"; }
> >> void Eat() const { std::cout << "Gobbling food...\n"; }
> >> void Growl() const { std::cout << "Grrrrr\n"; }
> >> void Whimper() const { std::cout << "Whining noises...\n"; }
> >> void RollOver() const { std::cout << "Rolling over...\n"; }
> >> void PlayDead() const
> >> { std::cout << "Is this the end of Little Caeser?\n"; }
> >>};
> >>
> >>typedef void (Dog::*PDF)()const ;
> >>
> >>int main()
> >>{
> >> const int MaxFuncs = 7;
> >> PDF DogFunctions[MaxFuncs] =
> >> { Dog::Speak,
> >> Dog::Move,
> >> Dog::Eat,
> >> Dog::Growl,
> >> Dog::Whimper,
> >> Dog::RollOver,
> >> Dog::PlayDead
> >>! };
> >> Dog* pDog =0;
> >> int Method;
> >> bool fQuit = false;
> >> while (!fQuit)
> >> {
> >> std::cout << "(0)Quit (1)Speak (2)Move (3)Eat (4)Growl";
> >> std::cout << " (5)Whimper (6)Roll Over (7)Play Dead: ";
> >> std::cin >> Method;
> >> if (Method == 0)
> >> {
> >> fQuit = true;
> >> break;
> >> }
> >> else
> >> {
> >> pDog = new Dog;
> >> (pDog->*DogFunctions[Method-1])();
> >> delete pDog;
> >> }
> >> }
> >> return 0;
> >>}
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>This SF.Net email is sponsored by BEA Weblogic Workshop
> >>FREE Java Enterprise J2EE developer tools!
> >>Get your free copy of BEA WebLogic Workshop 8.1 today.
> >>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> >>_______________________________________________
> >>Dev-cpp-users mailing list
> >>Dev...@li...
> >>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> >>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >>
> >>
> >>
> >
> >
> >
> >
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|