Home > Troubleshooting > Visual Studio gets Windows Mobile SDK location wrong.

Visual Studio gets Windows Mobile SDK location wrong.

November 29, 2008 Leave a comment Go to comments

After a good run of Windows Mobile (WM6) development on my x86 Vista laptop I started seeing the following when building any WM6 project:

1>—— Rebuild All started: Project: WMBattery, Configuration: Debug Windows Mobile 6 Professional SDK (ARMV4I) ——
1>Deleting intermediate and output files for project ‘WMBattery’, configuration ‘Debug|Windows Mobile 6 Professional SDK (ARMV4I)’
1>Compiling…
1>stdafx.cpp
1>e:\dev\projects\wm_battery\wmbattery\stdafx.h(14) : fatal error C1083: Cannot open include file: ‘ceconfig.h’: No such file or directory
1>Build log was saved at "file://e:\dev\projects\WM_Battery\WMBattery\Windows Mobile 6 Professional SDK (ARMV4I)\Debug\BuildLog.htm"
1>WMBattery – 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Normal Win32 C++ applications and C# applications had no problems building– it was just my WM6 projects. (and didn’t have the WM5 SDK installed to see if those builds were broken as well).  If I included the directory where "ceconfig.h" existed– C:\Program Files\Windows Mobile 6 SDK\PocketPC\Include\Armv4i – to the project’s "Additional Includes Directories" (which otherwise would make sense for such an error) I then saw:

1>—— Build started: Project: WMBattery, Configuration: Debug Windows Mobile 6 Professional SDK (ARMV4I) ——
1>Compiling…
1>stdafx.cpp
1>Compiling…
1>main.cpp
1>Battery.cpp
1>Generating Code…
1>Compiling resources…
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>.\WMBatteryppc.rc(11) : fatal error RC1015: cannot open include file ‘windows.h’.
1>Build log was saved at "file://e:\dev\projects\WM_Battery\WMBattery\Windows Mobile 6 Professional SDK (ARMV4I)\Debug\BuildLog.htm"
1>WMBattery – 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Alright, something’s going on here because projects shouldn’t be having a problem finding “windows.h.”  It was at this point that I remembered I had received the following dialog out of the blue prior to these problems starting

 

which hinted strongly that in some way my Visual Studio settings had gotten borked and since I had been running on “default” settings that maybe VS just forgot where the WM SDK was. 

I opened the default CurrentSettings.vssettings (%USERPROFILE%\My Documents\Visual Studio 2008\Settings) and compared it to another CurrentSettings.vssettings from another x86 box with the WM6 SDK installed.  Of the relatively few differences, the most notable was in the “Visual C++ Project System Package” ToolOptionsSubCategory node where I noticed that my Windows Mobile include/lib paths were pointing to "Program Files (x86)".  However this is a 32-bit system so there isn’t a “Program Files (x86)”.  So I cleaned up the XML .settings file (easier to edit if you open in VS, Edit>Advanced>Format Document (CTRL-K, CTRL-D)) ala:

  • IncludeDirectories Before:
    • <PropertyValue name="IncludeDirectories">Win32|$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include|Pocket PC 2003 (ARMV4)|$(VCInstallDir)ce\include;$(VSInstallDir)SmartDevices\SDK\PocketPC2003\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0;|Smartphone 2003 (ARMV4)|$(VCInstallDir)ce\include;$(VSInstallDir)SmartDevices\SDK\SmartPhone2003\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0;|Windows Mobile 6 Professional SDK (ARMV4I)|$(VCInstallDir)ce\include;C:\Program Files (x86)\Windows Mobile 6 SDK\PocketPC\include\ARMV4I;C:\Program Files (x86)\Windows Mobile 6 SDK\PocketPC\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0</PropertyValue>
  • IncludeDirectories After:
    • <PropertyValue name="IncludeDirectories">Win32|$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include|Pocket PC 2003 (ARMV4)|$(VCInstallDir)ce\include;$(VSInstallDir)SmartDevices\SDK\PocketPC2003\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0;|Smartphone 2003 (ARMV4)|$(VCInstallDir)ce\include;$(VSInstallDir)SmartDevices\SDK\SmartPhone2003\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0;|Windows Mobile 6 Professional SDK (ARMV4I)|$(VCInstallDir)ce\include;C:\Program Files\Windows Mobile 6 SDK\PocketPC\include\ARMV4I;C:\Program Files\Windows Mobile 6 SDK\PocketPC\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0</PropertyValue>

Next start up of Visual Studio, however, resulted in the "Microsoft Visual Studio is configuring the environment for first time use” dialog and the WM build problems still continued.  I checked CurrentSettings.vssettings again and saw that Visual Studio had changed those WM includes/lib paths back to those containing " (x86)"! 

Trying to import my fixed settings (instructions here) didn’t help.  I thought maybe it was pulling in this “Program Files (x86)” location from somewhere in the registry but a search for keys/values/data with values "C:\Program Files (x86)\Windows Mobile 6 SDK\PocketPC\include", "C:\Program Files (x86)\Windows Mobile 6 SDK", "C:\Program Files (x86)\Windows Mobile 6 SDK", and “Program Files (x86)” turned up nothing.  Same went for a smaller search of file contents—only turning up my corrupted vssettings files.  Did some environment variable go bad?  `set` in a normal cmd window didn’t reveal anything unusual and a `Tools.Shell cmd /k set` in Visual Studio’s command window (View > Other Windows > Command Windows) didn’t reveal anything either.

Reinstalling Visual Studio/WM SDK’s likely would have been a waste of time.  My last option was to reset my user’s Visual Studio settings:

[Elevated CMD Prompt]> "Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /resetuserdata

Problem solved– new and previously existing WM6 projects now build.  I just never figured out what caused the WM location settings problem. grr.

To be complete, the IncludeDirectories after /ResetUserData and starting up VS and getting "configuring the environment for first time use":
<PropertyValue name="IncludeDirectories">Win32|$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include|Pocket PC 2003 (ARMV4)|$(VCInstallDir)ce\include;$(VSInstallDir)SmartDevices\SDK\PocketPC2003\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0;|Smartphone 2003 (ARMV4)|$(VCInstallDir)ce\include;$(VSInstallDir)SmartDevices\SDK\SmartPhone2003\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0;|Windows Mobile 6 Professional SDK (ARMV4I)|$(VCInstallDir)ce\include;C:\Program Files\Windows Mobile 6 SDK\PocketPC\include\ARMV4I;C:\Program Files\Windows Mobile 6 SDK\PocketPC\include;$(VCInstallDir)ce\atlmfc\include;$(VSInstallDir)SmartDevices\SDK\SQL Server\Mobile\v3.0</PropertyValue>

Update 10/25/2009:

I started seeing the “ceconfig.h” problem again but this time I tried to directly handle it through global Options:

  • Tools > Options;
  • Projects and Solutions > VC++ Directories. 
  • Select your platform, e.g. “Windows Mobile 6 Professional SDK (ARMV4)” from the drop-down and then “Show directories for” > “Include files”. 
    • Include your include\ARMV4I directory, e.g. “C:\Program Files\Windows Mobile 6 SDK\PocketPC\Include\Armv4i”

Build again and it went further in the build process but as my library directories were incorrect I received:

1>LINK : fatal error LNK1181: cannot open input file ‘coredll.lib’

  • Tools > Options; Projects and Solutions > VC++ Directories; select your platform. 
  • This time select “Library files” from “Show directories for”.
    • Include your lib\ARMV4I directory, e.g. “C:\Program Files\Windows Mobile 6 SDK\PocketPC\lib\ARMV4I”

Build again.  At this point I no longer had any problems building. 

I likely have these problems as I keep my VS projects in sync between two systems with Live Mesh but the two systems are different architectures and also have different system drive letterings.  VS project settings are sensitive to their environment and I should know better but I’ve yet to find other ways of sharing project data so I will probably continue to see this.

Advertisements
Categories: Troubleshooting
  1. Luiz
    March 9, 2009 at 4:29 pm

    Thank you so much, you rock – resetuserdata did the trick for me too – mine was slightly different than yours, as i\’m on a 64-bit machine, but still same root cause – thanks again!

  1. No trackbacks yet.

Comment?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: