locked
Compiling a static library for ARM without the /ZW Option

    Question

  • I'm trying to compile my app for ARM, which makes uses of several open source C/C++ libraries that compile to static libraries (.lib). I then reference these .lib files in a C++ WinRT Component, and then I reference the WinRT component in C# for use in my app.

    Everything works great in x86, but now I'm running into issues with ARM. Specifically, I'm unable to compile one of the static libraries with the /ZW option.

    On x86, I can exclude the /ZW option on the static library and still get everything to compile, however on ARM, I can't do this. 

    If I leave the /ZW option checked, I get the following error:

    Error	7	error D8048: cannot compile C file '..\pdf\pdf_annot.c' with the /ZW option	

    This is just a regular old C file, so I don't understand why there is an error being thrown here-- no platform dependent stuff.

    If I uncheck the /ZW option, of course I get this error:

    Error	4	error MSB8022: Compiling Desktop applications for the ARM platform is not supported.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\ARM\PlatformToolsets\v110\Microsoft.Cpp.ARM.v110.targets	36	5
    

    So what can I do to get around this? Again, everything builds fine in x86, my app passes WACK and infact is already live in the Windows Store.


    Wednesday, October 24, 2012 10:11 PM

Answers

  • To change /ZW option for one file only, right click on the file name in the solution explorer view, and select "Properties".

    In the Property page, select C++/General,  and change the /ZW setting (you may want to select All Configurations). This change only applies to the selected file, while other files in the project use general project settings.

    You can define general compilation settings for your project, and have specific settings for a few files.

    For example, in my C++/CX project, /ZW is enabled for the project. But I disable /ZW for my old C files. I don't even need to create a separate LIB project which contains .c files.

    • Marked as answer by Ch3rryC0ke Thursday, October 25, 2012 12:55 AM
    Thursday, October 25, 2012 12:20 AM

All replies

  • I was able to make some more progress by disabling "Consume Windows Runtime extension" (mistakenly checked) and then choosing "Windows Store Support enabled".

    Wednesday, October 24, 2012 10:29 PM
  • Have you tried to disable /ZW option for the specified .c file only, not for the entire project?

    Wednesday, October 24, 2012 10:58 PM
  • Have you tried to disable /ZW option for the specified .c file only, not for the entire project?

    Thanks, I was able to get by without doing that, but just in case in the future, how can I do that? Does it have to be a command line argument to the compiler or is there some other place to set that?
    Wednesday, October 24, 2012 11:52 PM
  • To change /ZW option for one file only, right click on the file name in the solution explorer view, and select "Properties".

    In the Property page, select C++/General,  and change the /ZW setting (you may want to select All Configurations). This change only applies to the selected file, while other files in the project use general project settings.

    You can define general compilation settings for your project, and have specific settings for a few files.

    For example, in my C++/CX project, /ZW is enabled for the project. But I disable /ZW for my old C files. I don't even need to create a separate LIB project which contains .c files.

    • Marked as answer by Ch3rryC0ke Thursday, October 25, 2012 12:55 AM
    Thursday, October 25, 2012 12:20 AM
  • Thanks, that's very useful--- still new to Visual Studio, didn't realize each file has it's own property page. 
    Thursday, October 25, 2012 12:55 AM
  • Create a new windows phone static library project and add all the existing source files then keep the solution configuration as ARM and start

    building it. this is will solve the errorMSB8022.

    Thursday, January 24, 2013 11:04 AM
  • How were you able to solve this problem?

    I am currently struggling with trying to compile a static library so that it will work with ARM.

    Tuesday, July 9, 2013 9:40 PM