Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

I want to acess the C#.net class in my C++ project.
To do this I changed the project property settings as
project property settings->gernaral->common language runtime support to common language support (clr)
After setting this property I am getting following error :

Error 2 Command line error D8016 : /clr and &/EHs command-line options are incompatible cl

Can anybody help me?
Thanks in advance......


Regards,
RJ
Posted
Updated 23-Feb-21 18:17pm

From MSDN: /clr implies /EHa, and you cannot specify any other /EH compiler option with /clr.

So try to change this option in your project properties: under C/C++, Code Generation, change "Enable C++ Exceptions" to the appropriate value.

If it still doesn't work, consider creating a fresh new C++/CLI project and add you existing source files to this new project.
 
Share this answer
 
Comments
Member 7359839 17-May-11 8:50am    
Thanks for the reply....
What is the appropriate value???
I tried with all the three option under that.
But it is not working.
Olivier Levrey 17-May-11 8:56am    
So go to step 2: If it still doesn't work, consider creating a fresh new C++/CLI project and add you existing source files to this new project.

Changing the options on existing projects is often messy, I suggest you to start over with a new project and add your existing .h and .cpp files.
Sergey Alexandrovich Kryukov 17-May-11 16:46pm    
Yes, a 5.
--SA
This link might give you some idea http://forums.devx.com/showthread.php?t=93941[^]

/EH switch tells your compiler to enable C++ type exception handling mechanism.
You can try with /EHs or /EHc or /EHsc
 
Share this answer
 
Comments
Member 7359839 17-May-11 8:52am    
Thanks for the reply....
The link you provided is irrelevant.
We tried with changing below project properties for project and it worked:
1. Set Configuaration properties -> C/C++ -> Code Generation -> Enable C++ Exceptions
Yes with SEH Exceptions (/EHa)


2.Set Configuaration properties -> C/C++ -> General ->Common language runtime support(/clr)

3.Set Configuaration properties -> Advanced ->Common language runtime support(/clr)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900