Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / December 2006

Tip: Looking for answers? Try searching our database.

1 solution, 2 projects: how to use function form project B into project A

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
unknown; - 18 Dec 2006 14:55 GMT
hello,

i've got a question about using a function from project B in project A.
The projects are both in the same solution (using Microsolft Visual
Studio 2005)
the projects ara both native C++.

i've already added a reffrence from projectB into projectA.

i've got a function in projectA:
mainClass.cpp:
int main ()
{
   int i = 0;
   // i want to use function from project B like this:
   // i = functionFromProjectB (10);
   return i;
}

and in project B:
fileX.cpp:
int functionFromProjectB (int i)
{
   return i * 4;
}

i know, the example is a little stange but it may be usefull to explain
my problem.

my question is how to do this or is this a .NET functionality and not
possible with native C++ projects.
David Wilkinson - 18 Dec 2006 15:14 GMT
> hello,
>
[quoted text clipped - 27 lines]
> my question is how to do this or is this a .NET functionality and not
> possible with native C++ projects.

unknown;:

Are you related to IUnknown?

The easiest thing to do is just to add fileX.cpp to both projects. Of
course that means it will be compiled twice if you change it (unless you
make the output directories the same).

David Wilkinson
Bruno van Dooren [MVP VC++] - 18 Dec 2006 19:13 GMT
> i've got a question about using a function from project B in project A.
> The projects are both in the same solution (using Microsolft Visual
[quoted text clipped - 25 lines]
> my question is how to do this or is this a .NET functionality and not
> possible with native C++ projects.

Hi,

References are only useful for .NET projects.
If the second project is a library project, simply make it a dependency
of your other project and include the appropriate header files.

If the projects are not related in that way, you can simply add the
appropriate cpp file to your project.
That way the file gets compiled twice.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.