5

I want to write a kernel driver using Visual Studio 2015, so I installed the Windows 10 SDK and WDK alongside with VS 2015.

I created empty kernel driver project and main.c inside the project.

However, intellisense does not work and error list shows:

"command-line error: exception handling option can be used only when compiling C++ driver"

I suppose VS wants me to code my project on c++ but I don't want to code on c++. I hate casting when allocating memory etc. Are there any workaround for this?

Thanks

Burak Tamtürk
  • 1,237
  • 8
  • 19
  • if you use C++ memory allocators then you do not need to cast... – M.M Jul 29 '15 at 22:06
  • But I have other reasons not to write c++ in a such project (and how can i specify the type (e.g. paged, non-paged memory or user-mode, kernel-mode memory) via c++'s allocator) – Burak Tamtürk Jul 29 '15 at 22:12
  • It almost never makes sense to choose C over C++ since C++ can be written as a "better C." There is no law that says you have to use OO constructs, or that you can't use `malloc`, the OS memory APIs, or anything else you choose. I've got drivers written in C++ that you would have a hard time telling from C just by looking, but they enjoy the benefits that C++ brings to the table. – Carey Gregory Jul 30 '15 at 18:22

4 Answers4

2

C++ is usually not used in kernel mode drivers because it is not supported. I use some C++ in my drivers but that is the exception.

I see this same issue with VS 2015. Just create a blank C file in your project and you will see the intellisense (~) at the first column of the first line. This means intellisense is essentially broken for all C source files now.

  • Are there any workaround for this issue? / Do Microsoft know this bug? – Burak Tamtürk Aug 03 '15 at 21:54
  • 3
    No workarounds for now, and here's the bug report: https://connect.microsoft.com/VisualStudio/feedback/details/1623363/error-command-line-error-exception-handling-option-can-be-used-only-when-compiling-c – AlexPi Aug 04 '15 at 18:14
0

The obvious workaround is to disable IntelliSense.
Under the "Tools" menu, choose "Options". Then, click on "Text Editor", "C/C++", "Advanced". Inside the panel to the right, locate "InelliSense" and change the value for "DisableIntelliSense" to True.

drimtajm
  • 11
  • 1
0

Unfortunately this is a known Visual Studio 2015 issue with C code There will, hopefully, be a fix soon. More details here: https://www.osr.com/blog/2015/08/12/windows-10-wdk-visual-studio-2015-issues/

0

Visual Studio 2015 Update 1 recently released. The problem is now gone, everything works as usual.

Burak Tamtürk
  • 1,237
  • 8
  • 19