V
V
vvafree2016-10-21 13:21:18
C++ / C#
vvafree, 2016-10-21 13:21:18

How to organize variables if we add a file with a class?

Good afternoon.
There is a main.cpp file in which variables are declared and used.
There are modul.h and modul.cpp which implement a class that uses these variables.
I connected the header file, but it still shows that the variables in the class are not declared.
I thought in the class constructor to make a class declaration, but for some reason the byte array does not understand.
BYTE* buffer.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GavriKos, 2016-10-21
@GavriKos

There is a main.cpp file in which variables are declared and used.

Get rid of this. If you really need global variables, then use predefinition.

S
sitev_ru, 2016-10-21
@sitev_ru

int main() {
    int a = 5;
    int b = 10;
    Modul modul(a, b);
}

R
romy4, 2016-10-21
@romy4

Write in C
external variables are included as extern BYTE* var;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question