包括位于C C头++程序 [英] Including C headers inside a C++ program
问题描述
我有一个C ++程序(的.cpp)内,我希望使用一些这是C头文件,如stdio.h中,CONIO.H,stdlib.h中,有Graphics.h内present功能,devices.h等。
I have a C++ program (.cpp) inside which I wish to use some of the functions which are present inside the C header files such as stdio.h, conio.h, stdlib.h, graphics.h, devices.h etc.
我可以有我的cpp文件里面的文件stdio.h库:的#include< cstdio>
。
我如何包含其他的库文件?
I could include the stdio.h library inside my cpp file as : #include <cstdio>
.
How do I include the other library files?
我如何加入到Graphics.h库?
How do I add the graphics.h library?
我使用Microsoft Visual Studio 6.0企业版还的Turbo C ++ 3.0。
I'm using Microsoft Visual Studio 6.0 Enterprise Edition and also Turbo C++ 3.0.
推荐答案
有关C标准C头文件(标准输入输出,STDLIB,断言,...),prePEND一个C并删除.H的列表。
例如stdio.h中变得cstdio。
For a list of C standard C headers (stdio, stdlib, assert, ...), prepend a c and remove the .h. For example stdio.h becomes cstdio.
有关其他标题,使用
extern "C"
{
#include "other_header.h"
}
这篇关于包括位于C C头++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!