Solved

how to exchange values between severaly projects types ?

Posted on 2004-04-23
5
242 Views
Last Modified: 2010-04-17
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
0
Comment
Question by:raed2003
5 Comments
 
LVL 3

Expert Comment

by:diegojserrano
ID: 10905320
you will have to include the .cpp file of the class r into your new project.
0
 
LVL 1

Expert Comment

by:games0802
ID: 10906353
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
 

Author Comment

by:raed2003
ID: 10907310
how to include cpp file in c# windows application !!! ; also  i tried namespace.classname but it doesn,t work  ....
0
 
LVL 3

Expert Comment

by:yasser_helmy
ID: 10914157
i think you have to compile the vc project and then add a reference to it in the other project
0
 
LVL 1

Accepted Solution

by:
games0802 earned 100 total points
ID: 10914746
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now