JPEG parameter struct mismatch

前端 未结 2 591
陌清茗
陌清茗 2021-01-18 11:39

Ater compiling libjpeg and then using it, I stumbled upon the problem:

JPEG parameter struct mismatch: library thinks size is 512, caller expects 492
         


        
2条回答
  •  甜味超标
    2021-01-18 12:19

    In my case, the problem was that the library and my program were compiled with different values of HAVE_BOOLEAN, so boolean type had different size.

    Library was compiled with HAVE_BOOLEAN not defined, so it was using int as defined in libjpeg. Program was compiled with HAVE_BOOLEAN defined, and because some other headers were included before libjpeg, it was using unsigned char as defined in Windows RTL.

    Reason I used HAVE_BOOLEAN was to fix compile error about this, but it then caused a linker error. Instead, the proper solution was to not include Windows RTL (or any file that includes it) in the file that uses libjpeg.

提交回复
热议问题