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.
// Clvl 8, Dying Soldier
elseif (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--;
elseif (dir=='s' && menuchoice!=2)
menuchoice++;
elseif (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!
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.