Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Urgent help needed... Structs and compiling issues (http://www.chiefdelphi.com/forums/showthread.php?t=44216)

Salik Syed 17-02-2006 22:04

Urgent help needed... Structs and compiling issues
 
okay so i make a simple structure like this:
Code:

struct constants
{
int KP;
int KI;
int KD;
int div;
};

then reference it here:
struct constants pid[2]={{0,0,0,0},{0,0,0,0}};
this works fine and dandy but when i do this it gives me a linker error:

struct constants pid[4]={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};

What is going on I CANNOT figure it out! the linker says something like this:

idata_pid.o cannot fit the section. Section "idata_pid.o" length = 0x0000010a

please help...! i can't figure it out ... this is so simple yet frustrating

JonathanLKS 18-02-2006 11:39

Re: Urgent help needed... Structs and compiling issues
 
It sounds like you are using too much memory.
Try making the variables smaller like a short int or an unsigned char

Salik Syed 18-02-2006 12:07

Re: Urgent help needed... Structs and compiling issues
 
thats what i thought of as well... but doesn't a char take just as memory as an int ? i will try it though... i don't see why though... i mean watsons struct has 6-7 ints... maybe i have too many we'll see ... thanks

Dave Flowerday 18-02-2006 13:18

Re: Urgent help needed... Structs and compiling issues
 
Quote:

Originally Posted by Salik Syed
but doesn't a char take just as memory as an int?

A char is 8 bits and an int is 16 bits when the MCC compiler is used.

Greg Ross 18-02-2006 14:28

Re: Urgent help needed... Structs and compiling issues
 
Quote:

Originally Posted by Salik Syed
...this works fine and dandy but when i do this...:

struct constants pid[4]={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};

...the linker says something like this:

idata_pid.o cannot fit the section. Section "idata_pid.o" length = 0x0000010a

Each module is allowed only 256 (0x100) bytes of data. When you added this declaration to pid.c, you pushed it over the limit by 10 (0x0a) bytes. You might be able to get around this limit by putting the declaration in another .c file, and reference it as an extern from pid.c.



[edit]Woah! post #2048! Sweeeet! :D [/edit]

Salik Syed 18-02-2006 20:36

Re: Urgent help needed... Structs and compiling issues
 
[edit]Woah! post #2048! Sweeeet! [/edit]

anyone that jubilates over having a post count equal to a power of two is a true nerd.

161 posts until i can celebrate ;) !


All times are GMT -5. The time now is 22:05.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi