在vs2012里面使用c代码
1 创建testc.h 和testc.c文件
vs 创建testc.c,创建cpp文件时改后缀为c
2 文件内容如下
testc.h
#ifndef _TESTC_H_
#define _TESTC_H_
#include <stdio.h>
#include <stdlib.h>
int mysum(int a,int b);
#endif
testc.c
#include "testc.h"
int mysum(int a,int b){
return a + b;
}

本文详细介绍了如何在Visual Studio 2012环境下使用C语言代码。通过创建testc.h和testc.c文件,然后在main.cpp中引入并调用C函数,最终实现C代码在C++项目中的无缝集成,并展示了运行结果。
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



