473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to call function from c++ file from one project to another (Visual Studio 2005)

MySolution
|_ProjectA >> amain.c
|
|_ProjectB >> bmain.c

/*amain.c*/
#include <iostream>
using namespace std;
int main()
{
cout << add(10,20);
return 0;
}

/*bmain.c*/
#include <iostream>
using namespace std;
int add(int a, int b);
int main()
{
return 0;
}
int add(int a, int b)
{
return a + b;
}
Sep 2 '09 #1
3 4083
Banfa
9,065 Expert Mod 8TB
You can't not with your code structured like that.

The solution would be to have a 3rd project ProjectC that compiles to a static or dynamic library that contains add and then make both ProjectA and ProjectB depend upon ProjectC.
Sep 2 '09 #2
Banfa, how to do the things your are saying?
Sep 2 '09 #3
weaknessforcats
9,208 Expert Mod 8TB
Why does bmain.c have a main() in it?

Why not just name the function add() ??

Then you add bmain.c as a source file in Project A and use a function prototype in Project A.

Or:

Have Project B produce a DLL that you use in Project A.
Sep 3 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
10
by: bienwell | last post by:
Hi, I have a question about file included in ASP.NET. I have a file that includes all the Sub functions (e.g FileFunct.vb). One of the functions in this file is : Sub TestFunct(ByVal...
19
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site...
4
by: Bill Nguyen | last post by:
I converted a VB 03 app to VB 05 app successfully. It worked fine on my machine at home. I made a complete copy of the folder, copied to the machine at work and loaded the solution .SLN. I got the...
9
by: Jason | last post by:
Hi all, I am no longer able to publish a web site project using Visual Studio 2005 Professional. I am publishing it to an FTP url, and this used to work just fine. I enter the username and...
7
by: Nathan Sokalski | last post by:
I am an ASP.NET developer, and Visual Studio 2005 seems to have stopped declaring the controls that I add in the *.designer.vb files, therefore forcing me to manually add them before I can use them...
4
by: Author | last post by:
This is regarding VS2005-generated files. I've searched a little and found out that *.vshost.* files are VS2005 generated for debugging purpose and should not be published to the end user. ...
4
by: Vili | last post by:
How to copy a visual studio 2005 web project with another name? I have a visual studio project 2005 web project "myWebSite1" in visual source safe I would like to copy this project with another...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I cut and paste the following code from msdn help page which it just introduces view and multiview server controls. Here is what I do: in vs studio 2005, File --New Web Site, it...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.