Ray
Ray

Reputation: 16265

XCode compilation error for C++ code

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

Upvotes: 1

Views: 547

Answers (2)

Chandan Shetty SP
Chandan Shetty SP

Reputation: 5117

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

Upvotes: 0

Dair
Dair

Reputation: 16250

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.

Upvotes: 1

Related Questions