[Solved] extern type declaration conflict in C

Yes, it does cause overflow. Luckily your program is short enough that you didn’t notice the damage. Your code writes 8 bytes into a 4 byte variable. This will scribble on whatever follows a in memory. In your case there are no declarations after a, so it probably wrote over free space, but that’s not … Read more

[Solved] How can I use a class from a header file in a source file using extern but not #include?

Just to clarify. It is impossible to extern the class: class Outside { public: Outside(int count); GetCount(); } But, once you have the class available in framework.cpp, you CAN extern an object of type Outside. You’ll need a .cpp file declaring that variable: #include “outside.h” Outside outside(5); And then you can refer to that object … Read more