可以在Win7上使用MSYS2使用终止程序
我正在制作像发射器一样的GTK3应用程序。我使用MSYS2和MSVC2010在Linux和Windows7中开发。每一个都很好,除了我无法使用 terminateProcess ,因为我会收到此警告:
implicit declaration of function 'TerminateProcess'
这是代码的一部分:
#if defined(G_OS_WIN32)
#if defined(__GNUC__)
#include <w32api.h>
#define WINVER WindowsXP
#define _WIN32_WINNT WindowsXP
#define _WIN32_WINDOWS WindowsXP
#define _WIN32_IE IE7
#endif
#include <processthreadsapi.h>
#endif
#include <gtk/gtk.h>
// ...
void kill_process (GPid pid)
{
#if defined(G_OS_WIN32)
TerminateProcess (pid, 0);
#else
kill (pid, SIGTERM);
#endif
g_spawn_close_pid (pid);
}
上述功能 kill_process 在Linux和Windows中的预期工作(MSVC 2010),但与MSYS2 Mingw64相关...有什么想法吗?
I'm making in gtk3 app that behaves like a launcher. I'm developing in linux and windows7 with msys2 and msvc2010. Everyhing is fine except that I can't use TerminateProcess because I get this warning:
implicit declaration of function 'TerminateProcess'
This is part of the code:
#if defined(G_OS_WIN32)
#if defined(__GNUC__)
#include <w32api.h>
#define WINVER WindowsXP
#define _WIN32_WINNT WindowsXP
#define _WIN32_WINDOWS WindowsXP
#define _WIN32_IE IE7
#endif
#include <processthreadsapi.h>
#endif
#include <gtk/gtk.h>
// ...
void kill_process (GPid pid)
{
#if defined(G_OS_WIN32)
TerminateProcess (pid, 0);
#else
kill (pid, SIGTERM);
#endif
g_spawn_close_pid (pid);
}
The above function kill_process works as expected in linux and in windows (msvc 2010), but it doesn't with msys2 mingw64... any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论