extern?
Here''s a quicky. In C, what does the extern keyword signify? Does it have any meaning in C++?
Thnx
This means the linker should look for a variable in another object file.
Example:
// In test1.cpp
int test = 123;
// In test2.cpp
extern int test;
There are other uses of extern though, like to force the compiler to use c linkage in c++ files.
// In some c++ file
extern "C"
{
void MyFunc (int i);
}
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Example:
// In test1.cpp
int test = 123;
// In test2.cpp
extern int test;
There are other uses of extern though, like to force the compiler to use c linkage in c++ files.
// In some c++ file
extern "C"
{
void MyFunc (int i);
}
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement