How to Solve -------Undefined Reference to '_Chkstk_Ms'-------On Mingw

How to solve -------undefined reference to `__chkstk_ms'-------on mingw

The orig problem seems solved regarding linking against old libs, but I have opposite case.
I need to work with older GCC 3.4 version, so I installed gcc-v3-core package.
Then orig errors immediately appear when linking a trivial source.
I found out that MinGW GCC 3.4 cannot work with mingwrt > 3.20 and the problem is that gcc-v3-core contains incorrect mingwrt spec, allowing newest vesions.

The solution is simple:

mingw-get upgrade "mingwrt=3.20.*"

!Update!
Actually with mingwrt-3.20 linker reports same errors for C++ code:

g++ hello.cpp

BAM!

Solution 2:

mingw-get upgrade "mingwrt=3.18.*"

the last one that seems to work with gcc-v3-g++.

Newly downloaded gcc throws undefined reference to `__chkstk_ms' error

3.4.5, is that the version? That's very old!

Which MinGW were you using exactly?

I recommend using MinGW-w64 as it's more up to date.

You can get a standalone build from https://winlibs.com/

As for your errors, they are related to stack protection settings. Make sure you don't have different MinGW's in your system or referred to by environment variables like PATH.

MingGw error while trying to complie C code

Looks like the errors are related to stack protection.

Maybe your system has a mix of different MinGW versions installed, causing linking with mismatching libraries.

MinGW 3 is old, you should really consider moving to MinGW-w64.

You can get a standalone build of MinGW-w64 from https://winlibs.com/ that you can extract somewhere without installing to test if it makes a difference for your source code.

Make sure to use the full path to gcc.exe so you are in fact using the one you think you are using.

Cannot get open GL to run on Dev ++

Looks like you're linking with wrong version of C-runtime (CRT).

  • If you have multiple versions of MinGW installed, show Dev-C++ where to find right includes and libs (check your PATH environment variable, MINGW_HOME environment variable and Dev-C++ compiler options). You must use CRT which ships with compiler.
  • Try to #include <windows.h> before other includes. It can fix dllimports stuff
  • Try to add -m32 flag to compiler command line (it will emit code for x86_32, in case if you are compiling with 64-bit compiler)
  • Ask your teacher how to fix it (it's his (her) job, and it's (s)he who choose to use 10 years old stuff)

Note, that latest version of Dev-C++ was released 22.02.2005. It includes GCC 3.4.2 released September 6, 2004. You must really ask your teachers why would they insist on using 9 years old IDE with 10 years old compiler.
You can find maintained version of Dev-C++ here (it was picked up by another developer), and latest MinGW compiler here.



Related Topics



Leave a reply



Submit