未验证 提交 0e439210 编写于 作者: H HongyuJia 提交者: GitHub

[Fix Compile Error] Fix copysign compile error on Windows (#50387)

* fix copysign compile error on Windows

* fix more files' macro
上级 d5b55112
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX // msvc max/min macro conflict with std::min/max #define NOMINMAX // msvc max/min macro conflict with std::min/max
#endif #endif
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <windows.h> #include <windows.h>
#else #else
#include <sys/syscall.h> #include <sys/syscall.h>
......
...@@ -14,6 +14,10 @@ limitations under the License. */ ...@@ -14,6 +14,10 @@ limitations under the License. */
#pragma once #pragma once
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/enforce.h"
#include "pybind11/pybind11.h" #include "pybind11/pybind11.h"
......
...@@ -12,6 +12,10 @@ limitations under the License. */ ...@@ -12,6 +12,10 @@ limitations under the License. */
#include "paddle/fluid/pybind/eager.h" #include "paddle/fluid/pybind/eager.h"
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <string> #include <string>
#include <vector> #include <vector>
......
...@@ -11,6 +11,10 @@ limitations under the License. */ ...@@ -11,6 +11,10 @@ limitations under the License. */
#pragma once #pragma once
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include "paddle/fluid/eager/hooks.h" #include "paddle/fluid/eager/hooks.h"
#include "paddle/fluid/eager/pylayer/py_layer_node.h" #include "paddle/fluid/eager/pylayer/py_layer_node.h"
......
...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t; ...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t;
#endif #endif
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <string> #include <string>
#include <vector> #include <vector>
......
...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t; ...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t;
#endif #endif
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
......
...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t; ...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t;
#endif #endif
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
......
...@@ -10,6 +10,10 @@ See the License for the specific language governing permissions and ...@@ -10,6 +10,10 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
// disable numpy compile error // disable numpy compile error
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <string> #include <string>
#include <vector> #include <vector>
......
...@@ -10,6 +10,10 @@ See the License for the specific language governing permissions and ...@@ -10,6 +10,10 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
// disable numpy compile error // disable numpy compile error
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <set> #include <set>
#include <string> #include <string>
......
...@@ -12,6 +12,10 @@ limitations under the License. */ ...@@ -12,6 +12,10 @@ limitations under the License. */
#include "paddle/fluid/pybind/eager_utils.h" #include "paddle/fluid/pybind/eager_utils.h"
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <string> #include <string>
#include <vector> #include <vector>
......
...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t; ...@@ -16,6 +16,10 @@ typedef SSIZE_T ssize_t;
#endif #endif
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include "paddle/fluid/eager/hooks.h" #include "paddle/fluid/eager/hooks.h"
#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/lod_tensor.h"
......
...@@ -20,6 +20,10 @@ typedef SSIZE_T ssize_t; ...@@ -20,6 +20,10 @@ typedef SSIZE_T ssize_t;
#endif #endif
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include "paddle/fluid/pybind/pybind_variant_caster.h" #include "paddle/fluid/pybind/pybind_variant_caster.h"
......
...@@ -19,6 +19,10 @@ limitations under the License. */ ...@@ -19,6 +19,10 @@ limitations under the License. */
typedef SSIZE_T ssize_t; typedef SSIZE_T ssize_t;
#endif #endif
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <fstream> #include <fstream>
#include <vector> #include <vector>
......
...@@ -14,6 +14,10 @@ limitations under the License. */ ...@@ -14,6 +14,10 @@ limitations under the License. */
#pragma once #pragma once
#include <Python.h> #include <Python.h>
// Avoid a problem with copysign defined in pyconfig.h on Windows.
#ifdef copysign
#undef copysign
#endif
#include <vector> #include <vector>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册