I’m currently migrating my projects from Visual Studio 2008 to M2M Studio as Wavecom decided not to support Visual Studio any more.
However i have some trouble compiling my project in M2M, which compiled fine in VS:
question: I get a ton of warnings about un-handled enumerations in my switch statements:
..\src\xxxx.c:nnn: warning: enumeration value 'n' not handled in switch
I know that i don’t handle them, so how do i get rid of those annoying warnings?
question: The linker complains about multiple definitions of structs and vars defined in header files:
src\xxxx.o: In function `blahbla':
..\src\xxxx.c:995: multiple definition of `meh'
..\src\other_file.o:(.bss+0x1294): first defined here
I use the #ifndef include guard in my includes and this works perfectly fine when compiling my project both with VS built-in compiler and GCC supplied with OpenAT SDK.
Include guards only prevent including the same header more than once in the same source file - they have nothing to do with preventing multiple definitions across multiple source files.
I think I’ve seen this, and it’s a case of those tools letting you get away with it - your code is still actually flawed, and should really be fixed.
But i do not get these warnings when compiling my project in VS which also uses GCC.
That would be a waste of time, unsuring to include every single enum in every single switch statement! ADL has a ton of enums that in many cases are not needed and thus irrelevant in the current functions perspective.
Thanks for the link
Didn’t know that, thanks
So the conclusion must be that i need to declare all my structs, function headers etc. in the header files and then if i need a global variable, define it as an extern var?
Yes, I remember it now; it’s in (one of) the Wavecom C-GPS samples: there are definitions in header files - it shouldn’t have worked with the old tools but, somehow, it did!
That could be because M2MStudio comes with a different version of GCC, and/or because M2MStudio supplies a different set of default warning controls.
You’ll have to check the GCC documentaion to see if there’s an option to control this specific warning…
That depends on your point-of-view: a short-term “saving i [/i]of time” for the developer can result in wasting a lot of time for future maintainers of the code…
It’s a bit like insisting that every if and else clause has braces: it can seem like a “waste i [/i]of time” when you’re first writing it - but it can save huge amounts in future maintenance…
My next problem is that my software runs perfectly when compiled on my old setup with VS2008 and FW 7.3, however when i compile it in M2M Studio with FW 7.4, the modem just keeps restarting until it gives the message +WDWL after a while to indicate that i can now download new software.
I cannot debug the target either. I use the Q2687h.