functions position
I have Ubuntu 14.04 and Linux g++ compiler for c++14
I have a strange situation. Let's consider a large program with two functions located far apart:
1 2 3 4 5 6
|
function_1 (int B) { // line 950
Locations loc; // I get an error here: Locations aren't defined
......
loc.function_2 (5.0);
......
}
|
1 2 3 4 5 6
|
class Locations {
......................
function_2 (double C) { // line 2010
........
}
}
|
As evident from the code. I get a compile error in line 951:
Locations aren't defined in this code.
Does it mean that all classes and functions must be defined BEFORE they are called in the source code?
It this is true, it is a terrible news.
Thanks, - Alex
Last edited on
> Does it mean that all classes and functions must be defined BEFORE they are called in the source code?
yes. Variables too.
> It this is true, it is a terrible news.
¿why?
Also, old news.
Thanks, I got it.
Topic archived. No new replies allowed.