1、建立c的项目
使用vs能建立c的项目吗?可以,而且很简单。
添加一个后缀为.c的源文件。
2、测试当前是不是c编译器。
测试代码:
#include "stdio.h"
int main()
{
#ifdef __cplusplus
printf("hello");
#endif
return 0;
}
无输出,为c编译器。
3、建立cpp项目,只要将刚才的文件改为test.cpp即可。
#include "stdio.h"
int main()
{
#ifdef __cplusplus
printf("hello");
#endif
return 0;
}
有输出,为cpp编译器。