I have a group of function pointer objects in a header C++ file, I include this file in the main header file and then trying to use these objects in another C++ file (initialize function pointers and then use these pointers through another part of code) but I always get a “multiple defined” error. Is there a way how to declare global function pointer objects in a header file?
Share
You can do this in your main header. (Assusming you’re using a typedef called FnPointer)
Then in your implementation file
(
externmeans this variable will exist but I’m going to allocate space for it later in some other compilation unit. )