Creating C++ plugin with VS2022

@stevebaer,

  1. When I try to run Visual Studio 2022 following a similar procedure to that documented in Rhino - Creating your first C/C++ plugin for Rhino
    it fails when trying to create a new project as the Rhino 8 Plugin Wizard cannot be found:
    Here is what it looks like when I follow the guideline with Rhino 7 and Visual Studio 2019:


    But this is the result with Visual Studio 2022:

    Apparently it cannot find the Rhino Plugin Wizard.
    Suggestions?

  2. Another issue I am seeing is that changing the display is very slow in Rhino 8. Here is the code at the end of my script that adjusts the views:


    In Rhino 7 the Time to adjust views is only 88 ms:
    image
    while in Rhino 8 it takes nearly 2 sec or over 20x slower:
    image
    Does this make sense to you given the state of development of Rhino 8?

Regards,
Terry.

VS2022 was released last week. We do not have project wizards for it yet. If you have an existing project from VS2019, you should be able to open it in VS2022.

As for the second question, I don’t know why the timing difference exists. We would need to figure out how to repeat this on one of our machines to be able to make any sort of fix.

I will try opening my 2019 project in 2022.

For display slowness, I will time each line of code to try and find the culprit.

Regards,
Terry.

1 Like

Steve.

The slow down is in the redraw step:

New timing code:

Rhino 7 result shows 4.3 ms redraw time after running script 3 times.
image
Rhino 8 result shows 1.63 sec redraw time after running script 3 times.
image

It seems Rhino 8 is doing something way more complicated than Rhino 7 for the redraw.

Regards,
Terry.

Steve,

I made a copy of my VS2019 project and opened it in VS2022. Then I set the Platform Toolset to Visual Studio 2022 (v143) and C++ Language Standard to Preview which should select C++20 compiler. See below.

But when I go to build my project the rhinoSdkTMfcPages.h file and others will not compile:


Typical errors:







Everything works with C++17 selected in VS2022 and my C++ DLL gives correct results when called by my IronPython script in Rhino 7 and Python 3.9 in Rhino 8.

The most frequent error is the use of or and xor as an argument name:


I think C++ 20 treats these as a reserve work so it cannot be used as an argument name. One suggestion I see is to change it to xor_ in the header and body. This keeps it on the same semantic level as xor for understanding but avoids the compiler problem.

A similarly frequent error is identifier not found which I do not understand as the same code compiles in C++17.

Overall there seems to be only a tiny number of errors in the Rhino SDK code.

Looking for help here. There are some specific C++ 20 enhancements I am looking forward to using so I want to help solve these problems in any way I can.

Regards,
Terry.

Sorry I won’t be able to help with this yet. I do not even have VS2022 installed on my computers yet as another developer at McNeel is going through the process of figuring out what we need to do to upgrade to VS2022 for compiling without breaking our SDK.

In the very least keep the platform toolset at v142, I believe we are not going to update from that just yet.

I will wait until more support for C++20 in VS2022 is available and the Rhino 8 SDK is complete.

For now I can provide feedback on the Rhino Code Editor and use it to try exploring numpy in Python 3.9

Regards,
Terry.

I was wrong in my believe. I learned that we are going to figure out how to update to v143 already for v7.

@nathanletwory , @stevebaer ,

Any progress on getting Visual Studio 2022 working with C++ 20 for creation of Rhino plugins and C++ DLL’s? Currently the Rhino 7 SDK will not compile in C++ 20 but this is due to only 18 errors, which I documented in a post above.

I can get Visual Studio 2022 to work for generating my C++ DLL’s by copying over a VS 2019 project and limiting myself to using C++ 17. So Visual Studio 2022 seems good to go. I think I just need a Rhino 7 SDK that compiles in C++ 20.

Regards,
Terry.

I am still on VS2019, so no VS2022 insight from me.