# Windows 8 and Later Store Development > Modern Windows Apps (Metro) >  Trouble with C And Windows Runtime

## Greg658

I am a very experienced C programmer. I am getting into Windows 8.1 Store apps.

As we all know, when dealing with C on Visual Studio, the best best is to correctly name your source files as .c and not .cpp

The problem is that doing so in metro world gives lots of 'error D8048: cannot compile C file X with the /ZW option' errors. It is my understanding that I need this flag for the correct runtime.

I'd like to compile some legacy code with lots of malloc commands in, so renaming the files to .cpp is not practical unless I can turn off the resulting errors about casting from void*

Any idea how I can go about writing C for store apps?

----------


## 2kaud

This may be of help
http://stackoverflow.com/questions/9...with-zw-option

----------


## Greg658

Following the links advice, I started encountering varied problems and errors in header files I was not personally including directly. Some regression has clearly taken place in MSVS.

For now, I am using awk scripts to butcher my c into cpp. It is a shame that cpp lacks many convenient features such as named structure element initialization. I am not prepared to write cpp, I will just have to stick to the common subset for the short term.

----------


## Greg658

Thanks for the suggestion tho'. It was good to try.

----------


## 2kaud

> cpp lacks many convenient features such as named structure element initialization


What can you do in c that you can't in c++?

----------


## VictorN

> What can you do in c that you can't in c++?


Good question!  :Thumb: 
There are some very important thigs available in C++ (OOP for example) that are not available in C.
But vice versa?  :Confused:

----------


## Arjay

> Good question! 
> There are some very important thigs available in C++ (OOP for example) that are not available in C.
> But vice versa?


If you aren't on board with c++ at this point, you'll likely never be.

----------


## bestellen

The error message is exactly what it says it is - VC++ does not support C++/CX extensions - enabled with /ZW compiler switch - in files compiled as C (which kinda makes sense, since those extensions are object-oriented).

The reason why you're seeing this is that, by default, all files in a Metro C++ project are compiled with /ZW. Unfortunately, this also applies to .c files, even though it doesn't actually work for them. What you need is to disable the extensions selectively for those files. You can do so via right-click -> Properties on a file or a selection of files in Solution Explorer. In the Property Pages dialog, navigate to C/C++ -> General, and look for "Enable Windows Run Time Extensions".

----------

