1

I am trying to use my C++ classes for an iPhone app. I got 2 compilation errors in XCode that I do not quite understand. Here is the first one, in this header file myApps.h, I declare a class myApps and a struct PointF:

#pragma once
struct PointF {
    float x;
    float y;
};   // **compilation error message here :Multiple types in one declaration**

class myClass   { 
...
}

The second error is in a header file too,

#pragma once
class myClass1;
class myClass2;

class MyClass   
{
public:
  MyClass(void *view);
 ~MyClass();  

  virtual void Draw(myClass1 *c1); 
 //Error: Candidate is virtual void MyClass::Draw(myClass1 *)

  virtual void Move(myClass2 c2[], myClass1 *c1, void *callback);
  //Error: Candidate is virtual void MyClass::Move((myClass2, myClass1*, void*)
};

Thanks for your help

4
  • are you sure it's not generating error in some cpp file and then refer to these locations? Commented Jun 7, 2011 at 4:48
  • Please use proper formatting using {} seen above your edit box. Also make the question clearer. Commented Jun 7, 2011 at 4:49
  • You say you declare class myApps, you go and declare class myClass, and in the other file you declare class MyClass. Is this the exact code that causes you the problem? Commented Jun 7, 2011 at 4:50
  • What does the translation unit look like? These errors are almost always caused by a missing semicolon in a class declaration. Commented Jun 7, 2011 at 4:57

2 Answers 2

1

Ok, I don't know if this will help you but, from what I see:

myClass should have a semicolon at the end:

class myClass   { 
...
};

For the Candidate is virtual void MyClass::Draw(myClass1 *) below the last function of your class:

using myClass1::Draw;
using myClass1::Move;

since you probably have a method Draw and Move in myClass1... More on it here. It's hard to figure out exactly since I can't see the stuff in myClass1 and myClass2.

Sign up to request clarification or add additional context in comments.

Comments

0

Just check Whether your file extension is .m or .mm for C++ files it must be .mm extension.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.