Swagrim
Swagrim

Reputation: 422

Newly downloaded gcc throws undefined reference to `__chkstk_ms' error

I recently downloaded gcc and g++ compiler using MinGW and tried a simple hello world printing file in c. Whenever I run the code using visual studio code(using the code-runner extension made by jun han), I run into the following error:

C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(setargv.o):(.text+0x33): undefined reference to `__chkstk_ms'
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingwex.a(glob.o):(.text+0x6d2): undefined reference to `__chkstk_ms'  
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingwex.a(glob.o):(.text+0x8b8): undefined reference to `__chkstk_ms'
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingwex.a(glob.o):(.text+0x900): undefined reference to `__chkstk_ms'
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingwex.a(glob.o):(.text+0xa25): undefined reference to `__chkstk_ms'
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingwex.a(glob.o):(.text+0xc15): more undefined references to `__chkstk_ms' follow
collect2: ld returned 1 exit status

NOTE: I HAVE SEEN THE POST BY YUNUS

Upvotes: 0

Views: 645

Answers (2)

Brecht Sanders
Brecht Sanders

Reputation: 7287

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.

Upvotes: 1

Manish Dhiman
Manish Dhiman

Reputation: 1

add gcc path to you envionment variables

Upvotes: 0

Related Questions