1、安装 安装后,按照要求,重新启动,总是弹出 Cannot find one or more components,。。。 从而无法启动。 重装了3次,问题竟然又没有了。不知什么原因。 这是遇到的第一个问题。 第二个问题,编译出错,提示缺少文件。使用Appwizard生成的程序编译连接也出错,解决方法见2: 另一个问题是,以上只是配置项目,如何将include 和lib一劳永逸设置?? 参考3、 为Visual Studio添加默认INCLUDE包含路径一劳永逸的方法(更新) 2、 fatal error C1083: 无法打开包括文件:“SDKDDKVer.h” http://www.global-webnet.com/Blog/post/2012/04/14/Kinect-SkeletalViewer-Cannot-open-include-file-SDKDDKVerh-No-such-file-or-directory.aspx The solution is 3 easy steps... While evaluating C++ development for the Kinect (for my http://SolrContrib.CodePlex.com project) I ran into issues compiling the newly installed project from the Sample (on a fresh install of Windows 8 and Visual Studio 2011). In the end I found that "the juice wasn't worth the squeeze"; the C# demos performed just as well as the C++ demos(in the same task that will meet my concerns) with a fraction of the coding (and learning curve). Binging a solution wasn't productive - I am a C# developer (with no understanding of the C++ environment) trying to compile a project under Windows 8 using Visual Studio 2011. I learned early thatwhen you liveon the bleeding edge that sometimes youhave to bleed, I was hemorrhaging. I did however find an excellent clue within the VS11: C++ include directories not set correctly in new project bug reported on the Microsoft site. There was enough information to let me know that I required a "Windows Kits" folder (WindowsSdkDir) which will hold the SDKDDKVer.h. Long story short the Bing trail took me to the following: Windows Driver Kit (WDK) 8 Consumer Preview: http://msdn.microsoft.com/en-us/windows/hardware/hh852362 Step #1 - Download and install this development kit,I wasn't trying to create Windows Drivers, however I felt it was safe to assume it would have everything Windows Drivers developers required to compile their C++ applications. The assumption paid off; afterI installed it, along withthe Windows Driver Frameworks (WDF) Co-Installers it will recommend that you install, the folders were now available! But I was still not compiling! I went back to bug report and like Jennifer I did not have the required "/shared" folder in the Include directories path (which she manually added). HOWEVER, I did note a checkbox setting inherit from parent or project defaults as I stumbled around trying to find "HOW"includes worked in thisenvironment(using the following steps): Step #2 - comply with the following steps Right click on SkeletalViewer Project Select Properties Open Configuration Properties (ref SkeletalViewer Property Pages in image below) Selected VC++ Directories (not shown in image) Select Include Directories (shown in image below) Click the dropdown box (down arrow icon) that will appear to right of input field Select Edit (you will see Include Directories windows shown in image below) Click the Macros button and scroll down to the WindowsSDK_Include path (shown below) I saw how the $(WindowsSDK_includePath), included with "Inherited values", contained my /Shared folder!!! I clicked the Checkbox Inherit from parent or project defaults, exited all windows applying updates as applicable. I Hit compile and I got another error - this time for a .lib file (can't recall what it was). 白冰做法:WDK是默认安装在C:\Program Files\Windows Kits中,具体将C:\Program Files (x86)\Windows Kits\8.0\Include - shared - um - winrt 三个目录包含到项目中。 这也可以直接通过在项目设置中添加引用这个$(WindowsSDK_includePath) 变量来实现,这个环境变量已经存在了,可以在宏中查到。 Step #3 - I followed the same steps from 5 on for the Library Directories path. 白冰做法:将C:\Program Files\Windows Kits\8.0\Lib\win7\km\x86 包含到 这个项目中。 这里也可以建立和引用环境变量的方式:可是如何在visual studio中为自己的工程添加环境变量?参见4 I Hit compile and Walla! I can compile and run the KinectViewer application! 3、 为Visual Studio添加默认INCLUDE包含路径一劳永逸的方法(更新) 你是否曾经也有过这样的问题: 用VS的时候,有时会用到一些非自带的库,例如WTL、Boost、DX等,每次需要用到时都要在项目属性里添加相应的include目录,久而久之觉得有点麻烦。是否有解决办法呢? 于是我便在网上找相关资料,在StackOverflow网站上找到一篇相关的文章( 原文链接 ),文章里提到的一个办法是修改 C:\Users\user\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props 这个文件,在这个文件里添加需要include的目录,之前我一直是用这个方法,也没啥问题。 当我安装了VS2012之后,问题变出现了。在VS2012上新建一个MFC的工程,什么也没动,居然编译不通过,提示找不到某些文件,我便联想到了是不是之前修改了影响到了,于是我果断把修改的那个文件恢复成默认的内容,再试,结果就没问题了。。。可是这样就得每次都手动添加WTL的目录了。。我便开始翻VS的一些配置文件。 解决方案一: 修改 " VS安装目录中的\VC\VCWizards\default.vcxproj " 这个文件,(这其实就是个xml文件) 如我的目录是" D:\Program Files\Microsoft Visual Studio 11.0\VC\VCWizards\default.vcxproj " 如果我要添加的目录是" D:\Program Files\Microsoft Visual Studio 11.0\VC\WTL\include "; 用文本编辑器打开这个文件,定位到文件末尾,在 /Project 之前插入如下内容 PropertyGroup IncludePath $(VCInstallDir)\WTL\include;$(IncludePath) / IncludePath / PropertyGroup $(VCInstallDir)\WTL\include; 就是需要添加的目录了。 $(VCInstallDir) 是VS里的环境变量(在我的电脑上就是" D:\Program Files\Microsoft Visual Studio 11.0\VC "),表示VC的安装目录。 $(IncludePath) 是表示原有的路径。实际上最终得到的路径如图里四个 如果需要添加lib文件的路径的话。格式就是 LibraryPath/LibraryPath 添加完后保存即可,新建一个项目后,在项目属性里可以看到目录已经加进去了。大功告成,VS2010也是用同样的方法,只不过目录不同了。 解决方案二: 这个方法是结合了开头提到的StackOverflow网站上的修改方法。 依然是修改 " VS安装目录中的\VC\VCWizards\default.vcxproj " 这个文件,只不过这里修改的地方不同,用文本编辑器打开该文件,查找" $(UserRootDir)\Microsoft.Cpp.$(Platform).user.props "这段内容, 其实这里就是指向了我电脑上的那个文件 C:\Users\HwangBae\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props ;这里我就想到了,为VS2010和VS2012指定不同的文件, 将" $(UserRootDir)\Microsoft.Cpp.$(Platform).user.props "全部替换成" $(UserRootDir)\ VC11\ Microsoft.Cpp.$(Platform).user.props "。 然后在 C:\Users\HwangBae\AppData\Local\Microsoft\MSBuild\v4.0 这个目录下创建了两个文件夹,分别命名为VC10和VC11,然后将 Microsoft.Cpp.Win32.user.props 复制到这两个文件夹,然后除了这两个文件夹外的文件均可删除,其他的文件VS会在那两个文件夹里自动重新创建的; 然后编辑 Microsoft.Cpp.Win32.user.props 这个文件,在 Project 节点下按照方法一的步骤插入同样的代码。在VS2010的目录下也做同样的替换。到此就完事了。测试无任何问题。 总结一下这两种方法的区别,方法一修改后,只对新建的项目有效,在没修改之前创建的项目是无效的,而方法对于之前创建的项目也有效。哪种方法比较适合大家自己取舍。 转载请标明出处,原文地址: http://www.cnblogs.com/hwangbae/archive/2012/06/24/2560463.html 如果觉得本文对您有帮助,请支持一下,您的支持是我写作最大的动力,谢谢。 4、 可是 如何在visual studio中为自己的工程添加环境变量 ? 右击"我的电脑"--选择"属性"---选择"高级"--选择"环境变量"--就可以新建自己的环境变量名了 如: 变量名:MicrosoftSDKDir 变量值:C:\ProgramFiles\MicrosoftSDKs\ 如果要设置目录 C:\ProgramFiles\MicrosoftSDKs\Windows\v6.0\Include 以后就可以在VC中设置目录的时候可以(设置default.vcxproj中的 LibraryPath/LibraryPath ) $(MicrosoftSDKDir)Include 了 5、 WTL for Visual Studio 2012 配置详解 学习WTL有一段时间了,因前段时间去参加国赛耽搁几周,回来之后便继续学习,一直对VS2012有爱的我便想在12上面写WTL,上WTL的SVN看到,已经添加了对VS11 beta的支持,其实11就是2012。。于是我便down下来。 网上搜集了一些WTL环境的配置的资料,都写得不错,我在这里做更详细的补充。 Step1: 从WTL的SVN上获取所需的文件,这里需要两份文件 WTL include文件 http://wtl.svn.sourceforge.net/viewvc/wtl/trunk/wtl/include/?view=tar WTL wizard文件 http://wtl.svn.sourceforge.net/viewvc/wtl/trunk/wtl/Wizards/AppWiz/?view=tar 上面提供的仅是Win32所需要的文件,如果需要WTL的其他资源或整个项目,请访问下面的链接 http://wtl.svn.sourceforge.net/viewvc/wtl/?view=tar (以上链接请直接在浏览器打开,勿使用迅雷之类的工具下载) 下载下来是tar.gz的压缩包 可以使用WinRar或者7z之类的软件解压,我这里用WinRar,解压出来后得到两个文件夹 AppWiz就是将WTL添加到VS创建向导里的一些文件,include就是WTL的头文件。 在AppWiz文件里,有一个Files文件夹和多个setupxx.js文件 这些js脚本文件可以帮你将向导文件添加到VS的目录里,不同版本的VS对应不同的js文件 ,例如VS2012就是setup110.js (带x表示Express版本),这里我为了方便管理,需要做出一些修改; 找到" VS安装目录\VC\VCWizards\AppWiz "这个目录,如我电脑上就是" D:\Program Files\Microsoft Visual Studio 11.0\VC\VCWizards\AppWiz ", 在这个目录下新建一个 WTL 文件夹,然后将 Files 文件夹和 setup110.js 移动到WTL文件夹下。 然后将 Files 文件夹重命名为 Application ,然后用记事本编辑 setup110.js ,定位到第60行。 将 var strSourceFolder = FileSys.BuildPath(strValue, "Files"); 修改成 var strSourceFolder = FileSys.BuildPath(strValue, "Application"); 然后打开cmd,执行如下代码 wscript //e :jscript "D:\Program Files\Microsoft Visual Studio 11.0\VC\VCWizards\AppWiz\WTL\setup110.js" 执行完会提示应用程序向导安装成功。 这里再说下另一种方法,先不将Files改为Application,js文件也不修改,直接在cmd里执行安装,安装完后,将Files修改为Application,然后找到 D:\Program Files\Microsoft Visual Studio 11.0\VC\vcprojects\WTLAppWiz.vsz 这个文件,用记事本打开该文件 将第六行 Param="ABSOLUTE_PATH = D:\Program Files\Microsoft Visual Studio 11.0\VC\VCWizards\AppWiz\WTL\Files" 改成 Param="ABSOLUTE_PATH = D:\Program Files\Microsoft Visual Studio 11.0\VC\VCWizards\AppWiz\WTL\Application" 其实吧,不改也是没啥影响,只不过我比较蛋疼。。。。 到这里就完成了向导的添加,如果有洁癖可以把js文件删除掉了。 Step2: 添加WTL的头文件,解压出来的include文件夹下有这些头文件 我的做法是在 D:\Program Files\Microsoft Visual Studio 11.0\VC 下创建了一个WTL文件夹,将include文件夹放进WTL。(也可以放其他目录,配置include目录时改下即可) include目录的添加请参考我的另一片文章 为Visual Studio添加默认INCLUDE包含路径一劳永逸的方法 http://www.cnblogs.com/hwangbae/archive/2012/06/24/2560463.html 由于VFC还未更新对VS2012的支持,我这里就不写VFC的配置了。 如果配置的过程中遇到了问题,欢迎在博客留言讨论或者Email我。 欢迎转载本文章,但请标明出处,原文地址: http://www.cnblogs.com/hwangbae/archive/2012/06/27/2565591.html 如果觉得本文对您有帮助,请支持一下,您的支持是我写作最大的动力,谢谢。 FAQ A: 在cmd里执行js脚本时出现错误: 没有文件扩展 “.js” 的脚本引擎。 怎么解决: Q: 打开注册表编辑器,定位到HKEY_CLASSES_ROOT\.js,将默认值改成JSFILE。