在MFC应用程序中嵌入纯C项目 [英] Embed plain C project inside MFC application

查看:52
本文介绍了在MFC应用程序中嵌入纯C项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在纯c中创建了一个项目.但是现在我需要将其嵌入到MFC应用程序Project中.所以任何人都可以告诉我是否可行.如果是,那么该怎么办.如果不是,那么该怎么办.
请不要告诉我创建.dll文件,因为我正在其他地方使用当前的C项目.对不起,英语和语法不正确.请先谢谢.
粗体被删除-johny10151981 [/编辑]

I have created a project in plain c.But now i am required to embed that into MFC application Project. So can any one please tell me whether it is possible or not.If yes then how to do.If no then what to do.
Please don''t tell me to create a .dll file, as i am using the current C project somewhere else. Sorry for inappropriate English and grammar.Thanks in advance.
bold is removed-johny10151981[/Edit]

推荐答案

将C代码添加到C ++项目时,有两件重要的事情要做:

1-选择所有.c文件,右键单击属性","C ++",预编译头",预编译头",然后将使用"更改为不使用预编译头".

2-打开与.c文件相关的每个.h文件,并在开头的外部加注"C" {,并在末尾用}关闭.

请记住,c代码位于.c文件中,而C ++代码位于.cpp文件中.
There are two important things to do when adding C code to a C++ project:

1 - Select all .c files, right click to Properties, C++, Precompiled Headers, Precompiled Header and change "Use" to "Not Using Precompiled Headers".

2 - Open every .h file that relates to .c files and add at the beggining extern "C" { and close it with } at the end.

Remember that c code go in .c files and C++ code go in .cpp files.


将一个项目嵌入另一个项目是什么意思?
C项目的输出是什么-EXE/DLL/???

通过将源文件作为.C文件添加到MFC项目中,可以在MFC项目中使用源文件.
如果输出是EXE,则可以使用ShellExecute/CreateProcess从MFC项目中调用它.
如果输出是DLL或LIB,则可以像在MFC项目中一样正常使用.
What do you mean by embedding a project into another project?
What is the output of the C project - EXE/DLL/???

You use the source files in an MFC project by adding them as .C files into the MFC project.
If the output is an EXE, you can use ShellExecute/CreateProcess to invoke it from the MFC project.
If the output is a DLL or LIB, you can use as you would normally from the MFC project.


这篇关于在MFC应用程序中嵌入纯C项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆