error C2143: syntax error : missing ';' before '^'

Hey,

I'm relatively new to C++ and .NET and I am getting this error now in a Windows Forms project.
There seems to be some problem with the included headers and I was able to reproduce the error with a minimal example. I just don't have any idea how to work around it.

I have a class A like this. It is included in stdafx.h.
1
2
3
4
5
6
7
8
9
10
// A.h
#pragma once

#include "Form1.h"

ref class A
{
public:
	A();
}


I need to access code from Form1 in A but I also need a member of type A in Form1 so included A.h in Form1 as well and the error points to where I define the member like this.
1
2
public:
	A^ a;
Last edited on
why you don't just try to combine them in 1 header file? btw, you should put semicolon in the end of your class definition.

1
2
3
class A {
//...
}; //<------- 
Topic archived. No new replies allowed.