typedef not resolving

已回答

I have a program for Visual C++ that I would like to develop on CLion. I have managed to make it compile fine, however code insights are still showing errors on a bunch of things. Foremost among them is certain type definitions not resolving correctly. I have traced them through to the original definitions from the AMD OpenCL SDK, however those definitions have errors:

As far as I can tell, the problem is that it thinks it's defining the __int8 types. I believe that __int8 and the rest are supposed to be defined in the Microsoft Visual Studio stuff, but I can't figure out how to link that into the project using CMake or CLion.

I'm using CLion 2017.2.3 and have Microsoft Visual Studio 2017 Community installed.

I suspect that I'm not understanding something with how Microsoft Visual Studio integration works, but please let me know if there is any further useful information that I could provide.

0
Avatar
Permanently deleted user

The types __int8 etc. are built-in type aliases on Microsoft Visual Studio 2017. They are MSVC extensions to C/C++ (see here). CLion 2017.2.3 does not yet know about those extensions.

We are currently working on adding support for this and many other MSVC extensions. So code like this will be parsed correctly by CLion.

This feature will hopefully be available soon. Below is the associated ticket:

https://youtrack.jetbrains.com/issue/CPP-9224

1
Avatar
Permanently deleted user

Please check out the fix in the newest EAP and see if this fixes your problem:

https://blog.jetbrains.com/clion/2017/10/clion-2017-3-eap-msvc-extensions-multiple-compilers

1
Avatar
Permanently deleted user

That's fixed the vast majority of the problems, thanks! There's only one remaining 'getch() and _getch()':

 

I am able to fix these by #include-ing "<10.0.15063.0/ucrt/conio.h>" (part of the Windows SDK), but that's probably not a clean solution.

0
Avatar
Permanently deleted user

That's weird. `getch()` and `_getch()` are not any special MSVC language extensions, just normal library functions. They require `<conio.h>` to be included in order to be found (documentation here and here). Otherwise they cause an "undefined identifier" error in Visual Studio (I just checked). The same should happen in CLion. Conversely, if you do include the header, they should be found. Not sure what is going on in your project. Could you please submit an issue to our tracker with a code sample that reproduces the problem? Thanks!

1
Avatar
Permanently deleted user

My bad, it appears that the previous author hadn't included <conio.h> in that file and I must have missed the error in Visual Studio. Thank you very much for all the help!

0

请先登录再写评论。