vs c++ 和 mingw c++ 有什么区别?为什么我在 vs c++ 中无法 运行 这个?

what's the difference between vs c++ and mingw c++? why I fail to run this in vs c++?

http://www.sanfoundry.com/cpp-program-find-closest-pair-points-array/ 我可以 运行 这在 mingw c++ 中没有任何错误,但在 visual c++ 2013 中有很多错误。为什么?

首先,他们使用两个不同的 C/C++ 编译器 - Microsoft C/C++ Compiler and GCC.

您的示例使用 Variable-length array 就像这里一样。

float closestUtil(Point Px[], Point Py[], int n)
{
    ...
    int mid = n / 2;
    ...
    Point Pyl[mid + 1];
    Point Pyr[n - mid - 1];
    ...
}

Programming languages that support VLAs include Ada, Algol 68 (for non-flexible rows), APL, C99 (although subsequently relegated in C11 to a conditional feature which implementations are not required to support; on some platforms, could be implemented previously with alloca() or similar functions)

-- variable-length array 在 wikipedia.org

Microsoft 编译器不支持变长数组[1] (is not C99 compliant[2]) and GCC support it as and extension[7].

要解决这个问题,您可以将它们替换为 std::vector

您可以按照说明 here.

关闭 GCC 警告