简体   繁体   English

适用于Python 2.7的Visual Microsoft Visual C ++编译器与MinGW

[英]Visual Microsoft Visual C++ Compiler for Python 2.7 vs MinGW

I am making some functions in c which I am going to call from Python via Cython. 我正在用C编写一些函数,这些函数将通过Cython从Python调用。 I am developing these functions in Code:Block using MinGW C++ compiler. 我正在使用MinGW C ++编译器在Code:Block中开发这些功能。 But when building them for Python I have to use Visual Microsoft Visual C++ Compiler for Python 2. Then I have met a strang problem. 但是,当为Python构建它们时,我必须为Python 2使用Visual Microsoft Visual C ++编译器。然后我遇到了一个严重的问题。 When compiling with Visual C++ compiler I have after a lot of trial and fail found out that all variables have to be decleared before first in each block (if, for, function). 当使用Visual C ++编译器进行编译时,经过大量的尝试,我失败了,发现在每个块中的所有变量(如果是函数)之前,都必须清除所有变量。 Why is so. 怎么会这样 Are there difference between compilers for c? c的编译器之间有区别吗?

MSVC mostly adheres to the original C89 spec. MSVC主要遵守原始的C89规范。 In later revisions of the language this restriction has been lifted. 在以后的语言修订中,取消了此限制。

在C语言中(适当的C语言而不是C ++语言),变量必须在块的开头声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM