Mingw,boost和运行时“程序入口点无法找到”

问题描述:

问题

我正在使用mingw在Windows上使用websocketpp制作一个简单的服务器应用程序。我有我的代码编译和链接成功。然而,当我启动应用程序它给了我下面的错误窗口:Mingw,boost和运行时“程序入口点无法找到”

The procedure entry point _ZNSt6chrono3_V212steady_clock3nowEv could not be located in the DLL D:\work\wild_web\a.exe 

我的设置

以下是我编译和链接我的代码:

g++ -std=c++11 -march=i686 d:/work/wild_web/main.cpp -o a.exe -ID:/work/libs/boost_1_61_0 -ID:/work/websocketpp-master/websocketpp-master -LD:/work/libs/boost_1_61_0/stage/lib -lboost_system-mgw49-mt-s-1_61 -lws2_32 -lwsock32 -lboost_chrono-mgw49-mt-s-1_61 

Compilation finished at Sun Jul 24 16:48:09 

而且我这是怎么建提高:

b2 --build-dir=build-directory toolset=gcc --build-type=complete stage 

main.cpp中:

#define _WIN32_WINNT 0x0501 

#include <iostream> 

#include <websocketpp/config/asio_no_tls.hpp> 
#include <websocketpp/server.hpp> 

#include <boost/chrono.hpp> 

#include <string> 
#include <sstream> 
#include <vector> 
#include <map> 

//bunch of structs 
int main() { 
    //working with websocketpp 
    return 0; 
} 

我有一种感觉,问题出在我的#define上的第一个原始的,可能会导致dll的界面的变化。但是,如果我删除它,代码不会编译:

error: '::VerSetConditionMask' has not been declared 
const uint64_t condition_mask = ::VerSetConditionMask(

问题

  1. 是的#define _WIN32_WINNT 0x0501打乱了Boost库的使用情况如何?
  2. 我链接到正确提升?
  3. 如果对1和2的回答是肯定的,那么我该如何回答这个问题?
+0

'0x0501'用于'Windows XP'。它需要在'XP'上运行吗?您必须将'_WIN32_WINNT'设置为'boost:asio'。我发现'_WIN32_WINNT _WIN32_WINNT_WIN7'(0x0601)和'NTDDI_VERSION NTDDI_WIN7'可以在'Windows 10'上用'mingw'编译和运行。 – kenba

+0

我在Windows 8上。尝试了'#define _WIN32_WINNT 0x0602'和'#define NTDDI_VERSION NTDDI_WIN8',但不幸的是它没有帮助。 –

我得到了这个解决。

使用依赖关系walker我发现缺少的函数应该在libstd ++ 6.dll中。显然我有两个:一个属于Windows,另一个属于MinGW。它看起来像我运行我的应用程序时使用的Windows。

将.exe文件移动到MinGW库的文件夹中就行了。但我也发现有一个编译器标志-static-libstdc++可以用来静态链接到libstd ++ 6提供的函数。