basics of file inclusion

W

wallacej

Hi

I'm pretty new to C++ and even newer to Visual C++.NET 2002. I have a
question that involves what I assume to be the basics. If I have a cpp
file that contains a function I wish to call from my project how do I
include this cpp file? I've had a play around with header files but
cannot get it to work.

Thank You
 
A

Alf P. Steinbach

* wallacej:
I'm pretty new to C++ and even newer to Visual C++.NET 2002. I have a
question that involves what I assume to be the basics. If I have a cpp
file that contains a function I wish to call from my project how do I
include this cpp file? I've had a play around with header files but
cannot get it to work.

See sections 6 through 10 of chapter 1.6 of the attempted Correct C++ Tutorial
at <url: http://home.no.net/dubjai/win32cpptut/html/w32cpptut_01.html>.
 
K

Karl Heinz Buchegger

wallacej said:
Hi

I'm pretty new to C++ and even newer to Visual C++.NET 2002. I have a
question that involves what I assume to be the basics. If I have a cpp
file that contains a function I wish to call from my project how do I
include this cpp file? I've had a play around with header files but
cannot get it to work.

Just include the cpp file to your project.
(Open the file. right mouse click, select "Move xxx into Project")
 
W

wallacej

thank you for the advice. when i try adding the cpp file to the
project i get error message 'undeclared identifier' when i make a
function call
 
K

Karl Heinz Buchegger

wallacej said:
thank you for the advice. when i try adding the cpp file to the
project i get error message 'undeclared identifier' when i make a
function call

The error is in line 42 of file xxx.cpp

seriously: post code!
 
W

wallacej

sorry Karl I don't understand.

Alf, that tutorial looks very good, is filling in the gaps that I
missed when I learned the basics of C++. Looks like it will help a
great deal.
 
K

Karl Heinz Buchegger

wallacej said:
sorry Karl I don't understand.

The point is:
You cannot find your error although you are sitting in front
of your code and are staring at it.
But you expect us to find some error in your code even if we haven't
seen one source code line of it.

All we can do is: guess
You need to post some code, in order to help us to help you.
 
A

Andre Caldas

If I have a cpp
file that contains a function I wish to call from my project how do I
include this cpp file?

Usually you don't! You include a header file, compile both cpp files and
link them together.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top