Windows 使用MinGW g+;找不到静态库+;在窗户上

Windows 使用MinGW g+;找不到静态库+;在窗户上,windows,g++,mingw,static-libraries,Windows,G++,Mingw,Static Libraries,我正在使用一个名为libevent的静态库 这是我的密码: #include <iostream> #include "event2/event.h" using namespace std; int main() { event_base_new(); cout<<"hello"<<endl; return 0; } 当我尝试使用CMake构建代码时,仍然在Mac和Ubuntu上成功,在Windows上失败,并出现相同的错误。我在

我正在使用一个名为libevent的静态库

这是我的密码:

#include <iostream>
#include "event2/event.h"
using namespace std;

int main()
{
    event_base_new();
    cout<<"hello"<<endl;
    return 0;
}

当我尝试使用CMake构建代码时,仍然在Mac和Ubuntu上成功,在Windows上失败,并出现相同的错误。我在另一台Windows7 PC上再次这样做,但仍然无法工作。

库名为libevent_core吗?@Joel是的,它是libevent_core.lib,因此我认为-levent是正确的,在windows中使用“A”作为共享库扩展。因此,您可能需要在windows中编译该库。但是,我成功地使用GCC4.9.2链接了一个.lib库。可能还有其他东西使您无法链接。@Joel该库被编译为静态库,可以由Visual Studio链接,因此我认为这不是库的问题,但稍后我将尝试一个简单的hello world静态库,看看它是否工作。谢谢
g++.exe (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.