Linker Error: Automatic data segments exceeds 64k

Hi everyone. I'm getting the above error, "Linker Error: Automatic data segments exceeds 64k", and I can't figure out why. I'm using Turbo C++ 4.5. When I get the error, it doesn't point to any particular part of the program, but this is the only thing I added before it started occuring.
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 // Clvl 8, Dying Soldier
 else if (cevent==3)
 {
  for ( ; ; )
  {
	clrscr();
	printf ("\n\n\n\n");
	printf ("                    You see a soldier who is badly injured.                    \n");
	printf ("               He asks you for a Minor HP potion to heal himself.              \n");
	printf ("   You can't help but notice the finely-crafted jade amulet around his neck..  \n\n");
	printf ("                                What do you do?                                \n\n");
	if (menuchoice==0 && items[1]!=0)
	 printf("                        [ Give him a Minor HP potion ]                         \n");
	else
	{
	 printf("                          Give him a Minor HP potion                           \n");
	 if (menuchoice==0) // In case this isn't an option (No Minor HP potions)
	  menuchoice++;
	}
	if (menuchoice==1)
	 printf("                      [ Finish him and take his amulet ]                       \n");
	else
	 printf("                        Finish him and take his amulet                         \n");
	if (menuchoice==2)
	 printf("                         [ Ignore him and walk away ]                          \n");
	else
	 printf("                           Ignore him and walk away                            \n");
	dir = getche();
	if (dir=='w' && menuchoice!=0)
	 menuchoice--;
	else if (dir=='s' && menuchoice!=2)
	 menuchoice++;
	else if (dir==' ' || dir=='\r')
	{
	 if (menuchoice==0)
	 {
	  // ** Add content
	 }
	 if (menuchoice==1)
	 {
	  // ** Add content
	 }
	 if (menuchoice==2)
	 {
	  // ** Add content
	  return;
	 }
	}
  }
 }


If need be, I can post the code in it's entirety, but it is around 5000 lines, so I hope this is enough.
Any feedback would be extremely appreciated, thank you!
Last edited on
It sounds like the amount of addressable memory to store your variables has been exceeded. I'm guessing that your program is 5000 lines worth of string constants?

There is possibly a way to make your compiler accept a larger data segment in the configuration. Maybe making it 32bit application?

Or another option is to put all your text into a file on disk and read in the relevant parts as and when they are needed. Say have a different section (or file) for each location/action.

Topic archived. No new replies allowed.