bug-gplusplus
[Top][All Lists]
Advanced

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

bug report


From: Jonathan Harris
Subject: bug report
Date: Wed, 30 May 2001 02:50:16 -0400

 

I am new to c++ (and c for that mater) and I was trying to compile the
attached files using g++ Dinosaur.cc.  the problem occurred when I tried to return a struct from a function that.
The function is declared in the Dinosaur.hh as follows
 
  int setLengthOfSleep(int iHours,int iMinutes);
 
and the function I tried to call in Dinosaur.cc was: 
 
struct Dinosaur::getLengthOfSleep()
{
  return mhamLengthOfSleep;
}
 
(note: I originally tried the funtion as follows:
hoursAndMinutes Dinosaur::getLengthOfSleep()
{
  return mhamLengthOfSleep;
}
to which the compiler said:
 
Dinosaur.cc:121: parse error before `::'
Dinosaur.cc: In method `int Dinosaur::getLengthOfSleep()':
Dinosaur.cc:122: new declaration `int Dinosaur::getLengthOfSleep()'
Dinosaur.hh:48: ambiguates old declaration `struct
Dinosaur::hoursAndMinutes Dinosaur::getLengthOfSleep()'
Dinosaur.cc: In method `int Dinosaur::getLengthOfSleep()':
Dinosaur.cc:123: `struct Dinosaur::hoursAndMinutes' used where a `int' 
was
expected
 
but I expect that this is because I did something wrong)
 
-Jonathan Harris

 

Attachment: Dinosaur.cc
Description: Binary data

Attachment: Dinosaur.hh
Description: Binary data


reply via email to

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