After compiling the source to .o files and using "ar rcs libMyLibrarylib.a *.o" to make the library I am getting segfaults because I am using a header file with the member variables and private functions striped out. When I use the exact same header I do not get the faults. The segfaults happen when deleting the pointers in the map.
header used to create the lib
#include <**Type**>
class A
{
public:
A();
~A(); //In the destructor I iterate through the map to free everything before
void function();
private:
void privateFunction();
std::map<**Type**, int*> myMap;
}
header used with the compiled library
class A
{
public:
A();
~A();
void function();
}
Is there slicing or something when not using the exact header file? I want to hide the #include of Type from whomever is using the lib.
I have unit tests for the library, it does not segfault but it uses the same header file as was used to compile it.