Undefine Reference C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Undefine Reference C++

Hi all, I have started learning how to code with C++ and have just downloaded Codeblocks to programme. I'm sure I've downloaded all the necessary libraries however when I try to compile the "Hello world" code I get this error message: \mingw\lib\libmingw32.a(setargv.o)|| undefined reference to `__chkstk_ms'| I did have more errors like this before however I installed more libraries that got rid of them. Only this error remains. It's been a while since I've coded and first time coding with C++, any help will be much appreciated. \mingw\lib\libmingw32.a(setargv.o)|| undefined reference to `__chkstk_ms'|

3rd Apr 2020, 2:39 PM
Luke
Luke - avatar
10 Answers
0
Btw, you're free to join our discord server for more interactive help. https://discord.gg/3aRQq8 You can request the C++ role in "role-request" and then you should get access to a C++ channel.
3rd Apr 2020, 8:17 PM
Dennis
Dennis - avatar
0
Are you using an old version of GCC by any chance?
3rd Apr 2020, 4:15 PM
Dennis
Dennis - avatar
0
As far as I know, it's the latest version, I downloaded it all today. How would I check if everything's up to date? Just checked the codeblocks version and it's version 20.03
3rd Apr 2020, 6:50 PM
Luke
Luke - avatar
0
I meant the version of gcc, not codeblocks. If it's correctly installed you can check the version by typing "gcc --version" in the command prompt. Which codeblocks package did you select from this site? http://www.codeblocks.org/downloads/26 What do you mean with "All necessary libraries"? Which libraries? On windows you can just download the package "codeblocks-20.03mingw-setup.exe" install it and start typing.
3rd Apr 2020, 7:10 PM
Dennis
Dennis - avatar
0
Thanks, command prompt doesn't seem to recognise it. The codeblocks I installed is codeblocks-20.03mingw-setup.exe which should include GCC. The MingW installation manager had lots of libraries (Ming libraries) which I have installed aswell.
3rd Apr 2020, 8:00 PM
Luke
Luke - avatar
0
You'll have to add "CodeBlocks\MinGW\bin" to the PATH variable then for it to recognize it, but that's not really important now. Since you downloaded the setup with GCC you should have 8.1.0. I downloaded and installed it on a virtual machine and everything just works out of the box.
3rd Apr 2020, 8:03 PM
Dennis
Dennis - avatar
0
Thankyou, is that as simple as typing in "codeblocks\MinGW\bin" in the global compiler settings -> toolchain executables ?
3rd Apr 2020, 8:06 PM
Luke
Luke - avatar
0
No, that is unrelated to codeblocks( or to the actual problem ), it tells windows in which folders to look for commands, gcc is an executable in that directory, but this is a relative path, you have to get the full path where you installed it and then do this: https://docs.alfresco.com/4.2/tasks/fot-addpath.html
3rd Apr 2020, 8:09 PM
Dennis
Dennis - avatar
0
Thanks for your help, I've set the path and now when I type in GCC into command prompt it says: gcc:no input files
4th Apr 2020, 3:15 PM
Luke
Luke - avatar
0
Can you follow the instructions that I have posted on discord? Don't use codeblocks for this, notepad is good enough, I want to keep it minimal for now.
4th Apr 2020, 3:24 PM
Dennis
Dennis - avatar