Compile error: confusion between GetPixel Cvb and GetPixel Microsoft

Hi,
I am using CVB 13.00.005 (64).
I have made a DLL C++.
I have a compilation with icvcimg.h and GetPixel (that I never use):
1>api.cpp
1>…\iCVCImg.h(678,23): error C2116: ‘GetPixel’: function parameter lists do not match between declarations
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\wingdi.h(4155): message : see declaration of ‘GetPixel’

Do you have any idea to solve the problem without commenting GetPixel ans SetPixel in icvcimg.h ?

Thanks in advance,

Mikael.

Just a precision:

  • system : win 10 64
  • my DLL is a simple DLL (without MFC).
    Thanks,
    Mikael.

Hi @Mikael

first of all: I strongly recommend updating to the latest version of :cvb: and using the new object oriented CVB++ API.

The solution to your problem is as easy as it is “nasty”:
Delete the GetPixel definition from iCVCImg.h

The problem here is, that iCVCImg.h and wingdi.h both define the Get- and SetPixel functions and since Visual Studio 2019, the namespace hack won’t work no more…

    namespace CVB
    { // due to a naming collision with the windows GDI API these two functions
      // need to be accessed either through 'CVB::GetPixel' and 'CVB::SetPixel' or
      // with a 'using namespace CVB;'
      IMPORT(cvbbool_t)   GetPixel                          (IMG I, cvbdim_t Index,
                                                             cvbdim_t X, cvbdim_t Y, cvbval_t& Value);
...
    }

These functions are not recommended to be used anyway, so either just delete them or go for the new C++ API :blush:

2 Likes

Ok thanks for your anwser.
Regards,
Mikael.

1 Like