Why am I getting a procedure entry point error for this simple C++ code?

≯℡__Kan透↙ 提交于 2019-12-11 15:04:28

问题


I'm writing an SFML game and when I try to run the code this is the error I get:

The procedure entry point _gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll

I've linked to all the libraries correctly and the include files are correct. I've even tried what other answers suggested by putting the libstdc++-6.dll inside the directory of my exectable but still nothing.

Another answer said to put the MinGW/bin directory before any other directory in the PATH environment variable, which I did as well and it still didn't work.

Note: I get this error only when I try to use SFML code. It runs successfully when I comment it out.


回答1:


OK, the note you added tells me that the SFML stuff was compiled with another compiler version/configuration, newer one if memory serves right.

You need to make sure that SFML and your code are compiled by the same compiler (versions/configuration) or at least compatible compiler (versions/configuration).

I see that the latest binary packages of SFML use GCC 4.7, and the latest Code::Blocks (mingw) comes with the TDM GCC 4.7 build, so it might be enough to upgrade Code::Blocks and make sure you use the SFML GCC 4.7 TDM (SJLJ) package (and use the gcc that comes with Code::Blocks, of course).

Otherwise, you should probably install the TDM-GCC 4.7 compiler build manually, or if nothing works, compile SFML yourself.




回答2:


This is just a PATH ordering issue.

Most likely you'll have multiple libstdc++-6.dll files loaded in your path. You can check by running where libstdc++-6.dll in your command prompt.

What you do is to make sure your MinGW bin folder is loaded before everything else. Try moving it to the first one in your global PATH.



来源:https://stackoverflow.com/questions/24212090/why-am-i-getting-a-procedure-entry-point-error-for-this-simple-c-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!