I have a c struct define as: struct p { #include "file.h" }p; there are many warnings being thrown about this struct not being initialized when the code compiles. How can I fix these warnings ? How can I initialize such struct ?
Your code makes more sense now when you have updated it, but it's impossible to say why you get the warnings without seeing the code that cause them or at least the complete warning messages.
I'm a bit confused about this code but the warning is pretty clear. It wants you to initialize m_param in the constructor initialization list, like you do with m_systemInitialized.
i understand that it needs to be constructor initialized but i am not sure how this would be done since m_param is an object of a defined by the inclusion of FileParams.h, which is primarily defined by several macros as you can see the example from my earlier post.
The thing you need to remember with macros is that the compiler doesn't know that macros exist: They are already removed and replaced with the appropriate counterparts once it reaches the actual compilation stage. Hence, just define like normal, by the time it gets to that point it doesn't matter that it wasn't visible in the source file you wrote it in.
Peter87, I think you may be correct; using the implicit default constructor could fix the warnings. I will give it a shot today and see it that works. will keep you informed.