Are C++ projects supported in M2MS?

If I try to simply rename *.c into *.cpp or *.cc, then builder does not find those files.

  1. Is C++ compilation and linking available in M2MS?
  2. If yes, is it officially supported?


Today, M2M Studio does not support C++ build.
However it’s planned to integrate it, as several user feedbacks lead us to say that’s a missing feature…

Will keep you informed about that…

Thanks, dpo, for your answer.

Can you estimate time terms when the feature can be supported or, at least, available as a beta?
We are going to start new Q2687-based project and have to know this to make a decision.


I don’t think there’s a choice, then: You can’t start your project based on an an estimate that may or may not prove correct.
You have to start with what you know is available; ie, you have to start in ‘C’, not C++

C++ support was not integrated in 1.0.0 release because of higher priorities of other features.
However, it’s now under development, and it should be available (at least in beta) in one of the first 1.0.X maintenance releases, within the two coming months.

Best regards.

Everybody always has a choice :slight_smile:

There are some “minimalistic makefiles” there which allow the C++ build. And we also can play with them. But in fact we have to take into account many considerations like these:

  • if C++ will be supported soon then we will NOT try to play with the files;
  • if C++ will be supported in the indefinite future then we have another choice: play with C++ ourselves (lacking RTE debug) or write in plain C.

Have to clarify that this is a sample project which does not have definite timeline yet. So we must set it now, and it should be based on this info.

PS. While answering I found the dpo’s answer.
Thank you!Now we have a choice :slight_smile:

C/C++ is now supported in the 1.01 maintenance release :slight_smile:

Great! Will try it!

Hi osnwt. Did you succeed? Would love to hear how you got on with being one of the first M2M Studio C++ developers 8)

Hi jamie,

in fact I am new in Wavecom as well. So my experience may be not very useful for others.

I was unable yet to dig deeply into this. But just renaming the “Hello World!” sample file into *.cpp was not enough. I had some C++ warnings like “TRUE is not defined” (of course, because there is “#ifndef” there in ADL headers but MINGW does not define it as well). Also at the link stage I got some other errors as result of linking C libs with C++ compiled sources.

Again, I have not tried yet to build it anyway using extern “C” {…} blocks or like. But wish to ask you: do you have any suggestions regarding C++ projects in M2M? I mean using headers from OpenAT ADL library to support C++ build (do we need manual altering?), etc.

Of course, I will check it later when time permits but any ideas will be kindly accepted to not spend a time reinventing a wheel :slight_smile:

Actualy, there is a new help page in M2M Studio User Guide > Build System > Advanced Users listing all the stuff you have to add to your project in order to make it handling C++ correctly :wink:

Thanks for you hint :slight_smile:

If nothing helped - RTFM :slight_smile:

Yes that works to a point, still need to modify wip_file.h as indicated here:


Also the structure of wip_event_t (the enum wip_event_kind_t being defined within the structure def) means you have to do the following in any switch statements…

switch (kind)
case wip_event_t::WIP_CEV_DONE

It’s because of some really shocking coding by Wavecom - see: viewtopic.php?f=78&t=4201&p=16652#p16626


99% supported so far. It is not a supported problem for variable declaration, adding struct/class name:: resolution for static or enum member, using multi-tasks instead of adl_main, etc. Experienced developers can easily fix the problem. The 1% not supported comes from ADL limitation, that is, ADL does not init object properly if class/struct instance is declared globally. It probably does not invoke construct at all, and more…

The workaround is that the classs or struct in C++ not being decomposed into concrete atomic type does not declare as global instance. It should be declared within a function as local or static local instance, and then use a proxy class to access static local instance.

If knowing above ADL limitation, C++ is much safer and much powerful for OAT app in M2M. My project is using STL and TR1 shared pointer, GANG of FOUR factory pattern, composite pattern, and command pattern, etc. and has no problem generally.

Wish Wavecom can eliminate the above limitation at certain levels.

Indeed global class instance constructors are not called at initialization time. I guess you have already found the workaround by initializing a local static variable, and “making it global” through a global reference.
This restriction will be documented in future version. The point has been transmitted for fix in future Open AT OS versions.
Thanks for your feedback.

Can you please provide an URL to this help page???


In M2M Studio, go to Help > Help contents, and browse to M2M Studio User Guide > Build System > Advanced topics > Adding C++ code to an Open AT project

I’m finding that when attempting to create an object instance, the system is rebooting very soon afterwards.

Is there anything that needs to be done before attempting to create any objects? (i.e. is the “new” handler installed before calling adl_main?)

I find that even trying to create an instance of a record has the same consequences - do we need to perform “adl_memGet” calls instead of “new” ?

Assuming the guidelines provided by the help page are correctly followed (especially to map malloc/free on adl_memGet/adl_memRelease), the new operator is completely supported. Please check that you have correctly followed these guidelines.
Using C++ for embedded applications is far more tricky (particularly in debug) than doing a simple C program.
Please make sure you want to go this way before writing too many code impossible to debug…