Click to See Complete Forum and Search --> : Multiple projects


yossis
January 5th, 2006, 10:25 PM
I have a .Net solution that contains multiple projects of both Managed
C++ and C#.

There are references in one Managed C++ project's classes to classes in
another Managed C++ project.
i.e. Proj2::Class2 uses Proj1::Class1

Proj2 has a reference entry for Proj1

Each projects uses its own namespace, so Proj2::Class2.cpp has a #using
namespace line referring to the namespace declared in the Proj1 classes

I cannot get this scenario to compile. I get:
"error C2512: 'Proj1::Class1' : no appropriate default constructor
available"

If I add #include "Class1.h" to Class2.cpp, then I alse get this:
"error C2011: 'ManagedCppProj1::Class1' : 'class' type
redefinition"

I have tried the same scenario in a dummy solution with 2 simple
Managed C++ projects and get the same results.

Both projects are mixed mode and reference common unmanaged static C++ libraries

Any ideas??

NoHero
January 6th, 2006, 08:00 AM
Without seeing the code of which causes these problems, it will be hard to determine what the problem is.

humptydumpty
January 6th, 2006, 08:19 AM
not sure but meaning of the error is.No default constructor is available for the specified class, structure, or union. The compiler supplies a default constructor if user-defined constructors are not provided. If you provide a constructor that takes a nonvoid parameter, you must also provide a default constructor. The default constructor can be a constructor with default values for all parameters.
The following sample generates C2512:



class B {
public:
B (char *);
/* add the folling constructor
B() {
};
*/
};

int main() {
B b; // C2512
}



and second error occurs when a identifier was already defined as type. You may also get C2011 if you import a type library more than once into the same file.

For example:

struct S;
union S; // Error C2011


hopw this will help you

cilu
January 6th, 2006, 06:50 PM
I have tried the same scenario in a dummy solution with 2 simple
Managed C++ projects and get the same results.
Can you post that here?