问题描述
i am获取此错误
致命错误C1189:#error:" eh.h仅适用于C ++!"
我的问题是我有C ++ librabry和适当的.h文件
i想要访问它们是.c文件文件.....
要更具体我我在C文件中创建一个C ++对象...
这给了我错误! :(
可以任何身体请帮助我
如何访问C文件中的C ++对象...
谢谢你提前:)
hi ,
i am Getting this Error
fatal error C1189: #error : "eh.h is only for C++!"
my Problem is i am Having C++ librabry and Appropriate .h file
i want to Access Them is .c File Files.....
to Be More Specific i am Creating a C++ Object in a C file...
this Giving me the error!!! :(
can Any Body Please Help me
How to Access the C++ object in C file...
Thanks In Advance :)
推荐答案
一般来说,你不能。
你可以提供一个程序界面,
并在这样的头文件中声明它:
#ifdef __cplusplus
extern" C" {
#endif
void some_function(int,char *,double); //或其他什么
#ifdef __cplusplus
}
#endif
这可以是包括C和C ++。
In general, you can''t.
You can provide a procedural interface instead,
and declare it in a header file like this:
#ifdef __cplusplus
extern "C" {
#endif
void some_function(int, char*, double); // or whatever
#ifdef __cplusplus
}
#endif
This can then be included from both C and C++.
一般来说,你不能。 />
你可以提供一个程序界面,
并在这样的头文件中声明它:
#ifdef __cplusplus
externC {
#endif
void some_function(int,char *,double); //或者其他什么
#ifdef __cplusplus}
#endif
这可以从两个C中包含和C ++。
In general, you can''t.
You can provide a procedural interface instead,
and declare it in a header file like this:
#ifdef __cplusplus
extern "C" {
#endif
void some_function(int, char*, double); // or whatever
#ifdef __cplusplus}
#endif
This can then be included from both C and C++.
雅我可以这样做但是有很多类,而且有很多
函数....所以为每个写包装器是不可能..
所以有任何替代方法或任何Buit-in COde Genarator S / w
可以执行此任务!!
谢谢你的回复:)!等待回复!!
Ya i can Do that But There are Many Class and there are many
Functions....so Writting the Wrapper For Each is Not Possible..
so is there any Alternative method or any Buit-in COde Genarator S/w
that can Do this Task!!
Thanks For the Reply :)! waiting ahead For Reply!!
请看下面的页面
问候
Please have a look at the following page
http://www.parashift.com/c++-faq-lit...c-and-cpp.html
Regards
这篇关于如何在C中访问C ++类对象:获取错误致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!