I have an issue where it says:
Next to "class AStar{": Redefinition of "AStar" as a different kind of symbol
Next to "int AStar::calcH(int x, int y, int endX, int endY)": Expected a class or namespace
What is causing my issues, and how do I fix them? I'll post the whole class if needed. It is just that the class is very... complicated...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#import "AStar.h"
#include "AStar.h"
#include <iostream>
usingnamespace std;
@implementation AStar
class AStar{
int AStar::calcH(int x, int y, int endX, int endY)
{
int temp1=endX-x;
int temp2=endY-y;
if (temp1<0) temp1=-1*temp1;
if (temp2<0) temp2=-1*temp2;
return temp1+temp2;
}
on line 8 you're declaring class AStar again. I presume you've already declared it in the .h file. Remove the class AStar{ and the corresponding closing curly brace at the end of your file, and try again.
By the way, I'm pretty sure you don't need to both #import AND #include AStar.h. Just one of those should be sufficient, and #include is standard practice