how to exchange values between severaly projects types ?

Hi every body ; i created a new soluation and add a new Console project using vc  like this :

class r
{
    int x,y;
   r()
{
    x=4;y=5;
}
}

int main()
{
}

then i created anew windows application project using  c# in the same soluation  ; my question is how to create instance of this class created in vc project to use them in c# application ; thanks
raed2003Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
games0802Connect With a Mentor Commented:
You cannot directly add c++ files to a C# application (that I am aware of).  Instead, you can make a dll from your c++ files and then call the dll in C#.  If you need more details on the process of either making the dll or calling it in C#, just say the word.
0
 
diegojserranoCommented:
you will have to include the .cpp file of the class r into your new project.
0
 
games0802Commented:
You will either need to declare the new class in the new project's main .cs file and refer to it by [Namespace].[Class_name].  Or you could simply include the .cs file from your other project.  Be sure to comment out the main function as you can't have multiple entry points in one application.

Make sure you reference the namespace if they are different.
0
 
raed2003Author Commented:
how to include cpp file in c# windows application !!! ; also  i tried namespace.classname but it doesn,t work  ....
0
 
yasser_helmyCommented:
i think you have to compile the vc project and then add a reference to it in the other project
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.