المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : for programers in C++ and Visual C++



SomeOne
10-03-2002, 07:36 PM
Hello all, i'm new user for montada.com,
i was having problem in my program in C++
The Problem :
i was making a program containing two files the first is a.cpp the second is b.cpp
i declared some functions in a.cpp like( int counter; int there;)
i'd like to use this integers in the second file b.cpp without redefine.
i tried to re declare this integers in the second file to use them, but i found a problem, ("the integers count and there are redeclared")
i'm just begginer to c++ and visual c++
can anyone help ???
;)

Black_Horse82
11-03-2002, 07:29 AM
Asslam Alekom ...Brother...

I did not realy get what you meant when you said :
some functions in a.cpp like( int counter; int there
first these are variables not functions.

any way the solution to your problem is ::
when you write funtions in a file and you want to use these funtions you have to save this file with the extention .h (like a.h) which means that you try to make it as a liberary.
Then, when you write the second file and you wnat to include the first file in your second file you have to write in the first lines before the main funtion this line ....[COLOR=green]#include "a.h"[/COLOR [

SomeOne
12-03-2002, 03:22 AM
We aLekom el salam :)
Thanks Black Horse for ur help :)