是否可以使用 Visual C++ 编译预 ANSI(K&R 风格)C 代码? [英] Is it possible to compile pre-ANSI (K&R-style) C code with Visual C++?

查看:22
本文介绍了是否可以使用 Visual C++ 编译预 ANSI(K&R 风格)C 代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些带有 pre-ANSI(K&R 风格)函数声明的旧 C 代码.例如:

We have some old C code with pre-ANSI (K&R-style) function declarations. For example:

int foo(x, y)
double x, y;
{
    /* do some stuff */
}

是否有编译器开关来在 Visual C++ 2008 中启用对此的支持?

Is there a compiler switch to enable support for this in Visual C++ 2008?

推荐答案

为了编译这个代码,将代码放在 .c 文件中,而不是 .cpp 文件中.这指示 Visual Studio 将代码编译为 C 而不是 C++

In order to get this to compile put the code in a .c file vs. a .cpp. This instructs Visual Studio to compile the code as C instead of C++

这篇关于是否可以使用 Visual C++ 编译预 ANSI(K&R 风格)C 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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