MinGW, Pragma Once And BMax
BlitzMax Forums/BlitzMax Programming/MinGW, Pragma Once And BMax
| ||
Now as I understand it, #pragma once is deprecated in MinGW 3.1 and the problems relating to it were not fixed until 3.4 or something. It's also my understanding that we can't go beyond 3.1 when using BMax with MinGW. So when I'm trying to interface with a bunch of headers which use #pragma once and it's obviously causing problems. The warnings are fine, but things are being defined multiple times, presumably because they're being imported multiple times. What is the best way to resolve this? #include instead of #pragma once? Ignore warnings about the GCC 3.4? Something else? |
| ||
kick pragma, its a VC++ coding thing Replace it with #ifndef _h_headername #define _h_headername // here is the actual code #endif thats more standard like. |
| ||
I'm using 3.4.4 with BMax. Seems to work fine. As for #pragma once, no idea. However, your question about #include instead of #pragma once has me rather confused. #pragma once should be in header files that are #include'd, so it sounds like you're confusing the use of them. All I can suggest is that you try the standard include guard method. #ifndef _NAME_H_ #define _NAME_H_ // stuff #endif // !_NAME_H_ kick pragma, its a VC++ coding thing It's also much more convenient to use than the standard include guards. |
| ||
Yeah, these are all VC++ headers. I hope it's not gonna be too much of a PITA converting them. Thanks for the easy-looking solution. I'll edit all the headers accordingly and see if there are any non-pragma errors. |