•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,990 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,296 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 217 | Replies: 6
![]() |
•
•
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,574
Reputation:
Rep Power: 8
Solved Threads: 159
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,561
Reputation:
Rep Power: 36
Solved Threads: 860
Just guessing here, but do you want main() to call a function that is another *.cpp file? For example,
Now you have to compile main.cpp and foo.cpp then link the object files together to get a single executable program. Exactly how to do that depends on the compiler you are using because each one is different.
// foo.cpp
#include <iostream>
int foo()
{
std::cout << "Hello World\n";
return 0;
}// main.cpp
extern int foo();
int main()
{
foo();
return 0;
}Now you have to compile main.cpp and foo.cpp then link the object files together to get a single executable program. Exactly how to do that depends on the compiler you are using because each one is different.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
•
•
Join Date: Nov 2007
Posts: 833
Reputation:
Rep Power: 4
Solved Threads: 170
Well I take that you use the Dev-C++ IDE, so add the files to your project (create a new project, if you don't have one). Adding an existing file to project is done via Project/Add to Project menu. Once you have all required files you can build the project.
Here are some basic instructions ...
http://csjava.occ.cccd.edu/~gilberts/devcpp5/
Last edited by mitrmkar : Jun 12th, 2008 at 5:08 am. Reason: added link
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
Similar Threads
- problem linking my files (C++)
- Problems Linking C++ Files (C++)
- Linking files for Compilation in C++ Data Structures (C++)
- problems wid cpp files (C++)
Other Threads in the C++ Forum
- Previous Thread: GUI Type Scope and Instantiation
- Next Thread: i need graphics



Linear Mode