#ifdef内部结构初始化的用法

时间:2019-04-24 12:50:00

标签: c

在结构中的某些#ifdef上激活了一些值。因此,现在在初始化和定义结构变量时,如何在结构初始化中使用#ifdef。

struct Godown
{
   int nPotatoes;
   int nTomatoes;
   #ifdef winters
      int nGarlics;
   #endif
};

Godown street1 = {10,20,
                       #ifdef winters
                          50
                       #endif
                  };

1 个答案:

答案 0 :(得分:3)

该通用方法可行,但您需要将逗号吸收到res = cv2.matchTemplate(img[:,:,0], target[:,:,0], cv2.TM_SQDIFF_NORMED ) threshold = 0.00001 loc = np.where( res <= threshold ) img_rgb = img.copy() for pt in zip(*loc[::-1]): cv2.rectangle(img_rgb, pt, (pt[0] + 100, pt[1] + 100), (0,0,255), 2) 中:

#ifdef

尽管这样做的原因值得怀疑。

相关问题