[PLUG] C++ extern keyword
Daniel Herrington
dherrington at robertmarktech.com
Fri Apr 17 22:27:08 UTC 2009
All C++ gurus,
I'm a C++ newbie, so be gentle ;)
I'm trying to compile a vendor provided c++ file on RHEL 4, test_api .cpp,
and on compile it dumps with an error:
undefined reference to 'get_auto_event(event_ap*, int)'
The file I'm compiling calls get_auto_event. This function is referenced in
a header file autosys_api_auto.h that has this line:
extern int get_auto_event(EVENT_API *eapi, int polling);
Now in the same directory there is a get_auto_event.cpp file that has the
fully defined function:
int get_auto_event(EVENT_API *eapi, int polling);
...
My question is, how does the compiler know about that get_auto_event.cpp
defines get_auto_event from just the extern keyword in autosys_api_auto.h?
Does it just match by the name? Do I have to compile get_auto_event.cpp
before I can compile test_api.cpp, or will the compiler handle that
automagically? (The fact that get_auto_event.cpp doesn't compile is another
issue. That is trying to include a missing header file).
thanks,
--
Daniel B. Herrington
Director of Field Services
Robert Mark Technologies
dherrington at robertmarktechnologies.com
o: 651-769-2574
m: 503-358-8575
More information about the PLUG
mailing list