Mingw,boost和运行时“找不到过程入口点". [英] Mingw, boost, and runtime "procedure entry point could not be located"

查看:193
本文介绍了Mingw,boost和运行时“找不到过程入口点".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mingw在Windows上使用websocketpp制作一个简单的服务器应用程序.我得到了可以成功编译和链接的代码.但是,当我启动该应用程序时,它会显示以下错误窗口:

I'm making a simple server app with websocketpp on Windows using mingw. I got my code to compile and link successfully. However, when I start the app it gives me the following error window:

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

我的设置

这是我编译和链接代码的方式:

My setup

Here's how I compile and link my code:

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

这就是我建立助推器的方式:

And this is how I build boost:

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接口的更改.但是,如果我删除它,代码将无法编译:

I have a feeling that the problem is in my #define on the first raw that could cause the change of the dll's interface. But if I remove it, code won't compile:

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

问题

  1. #define _WIN32_WINNT 0x0501是否破坏了Boost库的使用?
  2. 我要正确链接以增强效果吗?
  3. 如果对1和2的回答是肯定的,那么我该怎么做?

推荐答案

我解决了这个问题.

使用依赖项遍历器,我发现缺少的功能应该在libstd ++ 6.dll中.显然我有两个,一个是Windows的,另一个是MinGW提供的.当我运行我的应用程序时,好像使用了Windows.

Using dependency walker I found out that the missing function was expected to be in the libstd++6.dll. Apparently I had two of those: one belonging to Windows and the other one provided by MinGW. And it looks like the Windows one was used when I run my app.

使用MinGW libs将.exe移到文件夹中就可以了.但是我还发现,有一个编译器标志-static-libstdc++可用于静态链接到libstd ++ 6提供的功能.

Moving the .exe into the folder with MinGW libs did the trick. But I also discovered that there's a compiler flag -static-libstdc++ you can use to link to the functions provided by the libstd++6 statically.

这篇关于Mingw,boost和运行时“找不到过程入口点".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆