简体   繁体   English

Visual C ++ UMDF V2模板似乎创建一个C项目,而不是C ++

[英]Visual C++ UMDF V2 template seems to create a C project as opposed to C++

I'm new to driver development. 我是驾驶员开发的新手。 I've been asked to write a Universal Mode Driver for a simple USB device. 我被要求为一个简单的USB设备编写通用模式驱动程序。 I've been reading the book "Developing Drivers with the Windows Driver Foundation." 我一直在阅读《用Windows Driver Foundation开发驱动程序》这本书。 I've also been looking at and trying to understand the code samples that the book refers to. 我也一直在研究并试图理解本书所引用的代码示例。 The book shows C++ code and the code examples I have been looking at are in C++. 这本书展示了C ++代码,而我一直在看的代码示例都是C ++。 I even had to go brush up on C++ because I haven't looked at it in this century. 我什至不得不精读C ++,因为本世纪我还没有研究它。 Using VS 2017, when I create a project from a template, I choose Visual C++ -> Windows Drivers -> WDF -> User Mode Driver (UMDF V2). 使用VS 2017,当我从模板创建项目时,选择Visual C ++-> Windows驱动程序-> WDF->用户模式驱动程序(UMDF V2)。 After the project is created, by all appearances, it is a C project rather than a C++ project. 从各个方面看,创建项目后,它就是C项目而不是C ++项目。 Am I simply confused? 我只是感到困惑吗? Well, the answer to that is Yes but why does it create a project containing files with .c extension as opposed to .cpp when clearly I chose a Visual C++ template? 好吧,答案是肯定的,但是为什么当我选择了Visual C ++模板时,为什么创建一个包含.c扩展名而不是.cpp的文件的项目? Any insights for a newby device driver? 对newby设备驱动程序有何见解?

UMDF 2 was designed to make it easier to port drivers to KMDF eventually. UMDF 2旨在简化最终将驱动程序移植到KMDF的过程。 Since C++ can't really be used in kernel mode, UMDF 2 projects are configured for C per default. 由于C ++不能真正用于内核模式,因此默认情况下,UMDF 2项目已配置为C。 If you want to use C++ change the compiler settings in the projects properties, but please make sure that no exceptions escape your code. 如果要使用C ++,请在项目属性中更改编译器设置,但请确保没有异常会转义您的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM