2 Replies Latest reply on Nov 9, 2020 5:28 AM by YeVe_4753746

    I have many errors when I try to use CyAPI.lib library in C++ application

    YeVe_4753746

      Hello All!

      I am using Visual Studio 2019 to create a C ++ Windows Forms Application using the appropriate extension.

      I made an application that displays an empty form.

      Next I want to connect the CyAPI.lib library.

      But as soon as I add #include <wtypes.h> at pointed place, I have gotten many errors.

      I found that the reasons for the errors lie in the file "C:\Program Files(x86)\Windows Kits\10\Include\10.0.18362.0\um\ servprov.h"

      I tried to solve this but couldn't find anything other than replacing * with ^ or other ways which didn't work or I couldn't understand ones.

       

      Help me please!

       

      CODE

      #pragma once
      
      
      #include <wtypes.h>
      #include <dbt.h>
      #include "CyAPI.h"
      
      
      namespace CppCLRWinformsProjekt {
      
      using namespace System;
      using namespace System::ComponentModel;
      using namespace System::Collections;
      using namespace System::Windows::Forms;
      using namespace System::Data;
      using namespace System::Drawing;
      
      /// <summary>
      /// Zusammenfassung fьr Form1
      /// </summary>
      public ref class Form1 : public System::Windows::Forms::Form
      {
      public:
      
      
      Form1(void)
      {
      InitializeComponent();
      //
      //TODO: Konstruktorcode hier hinzufьgen.
      //
      }
      
      
      protected:
      /// <summary>
      /// Verwendete Ressourcen bereinigen.
      /// </summary>
      ~Form1()
      {
      if (components)
      {
      delete components;
      }
      }
      
      
      private:
      /// <summary>
      /// Erforderliche Designervariable.
      /// </summary>
      System::ComponentModel::Container ^components;
      
      
      #pragma region Windows Form Designer generated code
      /// <summary>
      /// Erforderliche Methode fьr die Designerunterstьtzung.
      /// Der Inhalt der Methode darf nicht mit dem Code-Editor geдndert werden.
      /// </summary>
      void InitializeComponent(void)
      {
      this->components = gcnew System::ComponentModel::Container();
      this->Size = System::Drawing::Size(300,300);
      this->Text = L"Form1";
      this->Padding = System::Windows::Forms::Padding(0);
      this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
      }
      #pragma endregion
      };
      
      
      }
      

      ERRORS:

      1>------ Build started: Project: CppCLR_WinformsProjekt3, Configuration: Debug x64 ------ 1>CppCLR_WinformsProjekt.cpp 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(91,81): error C3699: '*': cannot use this indirection on type 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(91,81): message : compiler replacing '*' with '^' to continue parsing 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(98,9): error C2371: 'IServiceProvider': redefinition; different basic types 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(44): message : see declaration of 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(115,41): error C2872: 'IServiceProvider': ambiguous symbol 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(98,9): message : could be 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(44,19): message : or       'System::IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(239,22): error C2872: 'IServiceProvider': ambiguous symbol 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(98,9): message : could be 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(44,19): message : or       'System::IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(249,32): error C2872: 'IServiceProvider': ambiguous symbol 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(98,9): message : could be 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(44,19): message : or       'System::IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\urlmon.h(6869,66): error C2872: 'IServiceProvider': ambiguous symbol 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(98,9): message : could be 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(44,19): message : or       'System::IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\urlmon.h(6871,62): error C2872: 'IServiceProvider': ambiguous symbol 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(98,9): message : could be 'IServiceProvider' 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\servprov.h(44,19): message : or       'System::IServiceProvider' 1>Done building project "CppCLR_WinformsProjekt3.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========