Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error D8016: '/ZI' and '/clr' command-line options are incompatible

I am getting the following error in my program:

  error D8016: '/ZI' and '/clr' command-line options are incompatible

This happens when I put the following lines and enable common runtime in configuration->General (If I dont enable it then the error will come at using system and System::Drawing )

#using <system.drawing.dll>
using namespace System;
using namespace System::Drawing;

Actually I will be using some windows library in my code that requires the above dll.

How to solve this issue?

#include "opencv2/highgui/highgui.hpp"
#include <opencv2/imgproc/imgproc_c.h>
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <ctype.h>
#using <system.drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace std;

int main( int argc, char** argv )
{
IplImage *source = cvLoadImage( "Image.bmp");
// Here we retrieve a percentage value to a integer
int percent =20;
// declare a destination IplImage object with correct size, depth and channels
  IplImage *destination = cvCreateImage
( cvSize((int)((source->width*percent)/100) , (int)((source->height*percent)/100) ),
                                 source->depth, source->nChannels );
//use cvResize to resize source to a destination image
cvResize(source, destination);
// save image with a name supplied with a second argument
   cvShowImage("new:",destination);
  cvWaitKey(0);
 return 0;
 }
like image 445
gpuguy Avatar asked Nov 11 '12 12:11

gpuguy


3 Answers

In visual studio to turn off /ZI:

  1. Open the project's Property Pages dialog box.
  2. Click the C/C++ folder.
  3. Click the General property page.
  4. Modify the Debug Information Format property - set it to "None"
like image 135
PGP Avatar answered Nov 08 '22 06:11

PGP


In addition to what the Answer by PGP suggests, consider also changing C/C++ -> Optimization -> Optimization to Disabled (/Od).

Having it as Maximum Optimization (Favor Speed) (/O2) might give you problems when compiling for debug.

-O2 it's a certain level of compile-time optimisation. Google about what it does

like image 39
Kari Avatar answered Nov 08 '22 07:11

Kari


Upgrading VS will help. Minimum version: 16.11.11

like image 2
karthik vr Avatar answered Nov 08 '22 06:11

karthik vr