GameAcademe

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  0 Posts :: 14 Stories :: 5 Comments :: 0 Trackbacks

常用链接

留言簿(5)

我参与的团队

搜索

  •  

最新评论

2004年写的老文章,从CSDN转移到这里

今天读了microsoft的mvp网站(www.mvps.org)上的一篇关于添加VC源文件扩展名的文章

http://www.mvps.org/vcfaq/ide/1.htm)。顺便就把它摘要翻译下来,放在blog上以备参考

原文如下:

Question: How do I get Visual Studio to recognize .cc files as c++ source files?

如何使得Visual Studio能够把.cc后缀名的文件当作C++源文件来(编译)处理。

Answer:  Use the /Tp option of the compiler to instruct it to assume the file is C++. You can put this in as a custom build rule, or modify some registry settings to add .cc to the list of file extensions recognized as C++. The key to modify is:


可以使用/Tp编译选项指示编译器把.cc文件当作C++源文件来进行处理。可以把/Tp命令添加在工程的"custom build"选项中。或者可以通过修改注册表,把.cc后缀名添加到“可当成是C++源文件来处理的文件”的后缀名列表中。要修改的键如下:


HKEY_CURRENT_USER\Software\Microsoft\DevStudio\X.0\Build System\Components\Platforms\Win32 (x86)\Tools\32-bit C/C++\Input_Spec

and

HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Build System\Components\Tools\<Component 0x3>\Input_Spec

where X is the DevStudio version (5 or 6). You'll probably want to modify the following key to get automatic source code syntax coloring:

X是Devstudio的版本号(5或者是6)。同时可以通过修改下面的键来使得有新后缀名的文件也能使用语法高亮显示功能。

HKEY_CURRENT_USER\Software\Microsoft\DevStudio\X.0\Text Editor\Tabs/Language Settings\C/C++\FileExtensions

This method is nicer because it will save you a lot of work setting up the custom build rules. However, you still have to add the /TP switch manually to the Project Settings to get the compiler to fully recognize the file as C++. The downside: You won't be able to mix C and C++ files in the project, in which case, the only option is using custom build rules.

修改注册表要比通过设置/Tp命令来得方便,当然也可以使用后者。最后,不能通过修改注册表来在同一工程中混合使用C源文件和C++源文件。唯一的可行方法就是使用custom build规则

posted on 2011-04-20 16:33 游戏研究院 阅读(290) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理