Is it possible to declare something like an integer without defining it?
In C++, it is possible to separate the definition and declaration of a function.
// foo.cpp int foo(int); int foo(int a) { return 45; } But with a non-function it doesn't appear to be
// bar.cpp int bar; int bar = 10; bar.cpp produces this
$ clang++ -c bar.cpp bar.cpp:2:5: error: redefinition of 'a' int a = 10; ^ bar.cpp:1:5: note: previous definition is here int a; ^ 1 error generated. Leaving off the type annotation on the second statement produces a different error.
// bar2.cpp int bar; bar = 10; produces
$ clang++ -c bar2.cpp bar2.cpp:3:1: error: C++ requires a type specifier for all declarations bar = 10; ^ 1 error generated.