As size of structures are different, I think compilers should understand this and generate warnings.
The problem is that by the time you are connecting your code with the code of the library the compiler is out of the picture. The program that makes the connection (the linker) has no idea that the two binary codes that it tries to connect use structures of different size - in fact, linker has no idea that the programs used any data structures at all: it operates on a different level.
That is why it is not possible for the tools in the C++ toolchain to produce a reliable warning for you. This does not mean, however, that you cannot prevent it yourself: all it takes is embedding some sort of a build number into the library and its header, and comparing the two at the time when you initialize the library.