Read and Write big numbers

Okay, so here is the code I wrote for reading and writing the same large number.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <fstream>
#include <string>

using namespace std;

typedef int huge_num[1000];

int main(int argc, char *argv[])
{
	huge_num array;
	int len, i;
	char number[100];
	
	ifstream in("nrmare.in");
	ofstream out("nrmare.out");
	
	in.get(number,100);
	len = strlen(number);
	
	for (i = len-1; i > 0; --i)
		array[len-i-1] = (int)(number[i]-'0');

	for (i = len-1; i > 0; --i)
		out << array[i];
	
	in.close();
	out.close();
	
	return 0;
}


The compiler returns:

Linking...
C:\Program Files (x86)\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingwex.a(pformat.o):pformat.c:(.text+0x3f4): undefined reference to `__chkstk_ms'
C:\Program Files (x86)\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingwex.a(pformat.o):pformat.c:(.text+0x66f): undefined reference to `__chkstk_ms'
C:\Program Files (x86)\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingwex.a(pformat.o):pformat.c:(.text+0xa94): undefined reference to `__chkstk_ms'
C:\Program Files (x86)\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingwex.a(pformat.o):pformat.c:(.text+0x13df): undefined reference to `__chkstk_ms'
collect2: ld returned 1 exit status


Can anyone explain what I am doing wrong ?
Update your compiler.
Can you recommend me a good one ?
I got it my compiler + IDE from here: http://koti.mbnet.fi/vaultec/mingwstudio.php

The one which is 21.6Mb.
BTW jumper007: MinGW 3.4.5? Is this some kind of a joke? Look at the calendar, today isn't April the 1st!!! You should get version 4.7, and you have 3.4.5! PLEASE tell me you're joking!!!
As it's such an old IDE too, maybe don't install just the compiler, this is a great IDE that comes with a good compiler: http://orwelldevcpp.blogspot.com/2012/06/dev-c-5203-released.html
Yes, but at school we are using MinGW 3.4.5 and all the programming contests / olympiad are on that IDE/Compiler.
OK, in that case, I don't know what you should do.
EDIT: Maybe you should tell people at you scool it an ancient compiler and bad IDE and they should switch! xD
PS: Just kidding !
Last edited on
Nah, I should, but sadly that's the official version used by all schools in our country XD
There's nothing wrong in your compiler.

I had this same problem a while ago after I updated the MinGW runtime libraries to the latest version. Ironically the latest MinGW runtime libraries are buggy so updating your compiler wont do any good.

What you need to do is to downgrade the MinGW runtime libraries to version 3.20 (version 3.20-2 is the buggy version).

Download mingwrt-3.20-mingw32-dev.tar.gz and mingwrt-3.20-mingw32-dll.tar.gz packages from here:
http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.20/

And extract them to your compiler folder.
With latest GCC windows port the code does not compile, it needs <cstring> header included. After that, it compiles and links just fine.
Topic archived. No new replies allowed.