![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
lambcutlet
Joined: 08 Jan 2008 Posts: 5
|
Error 144 "stdlib.h" |
Posted: Tue Jan 08, 2008 8:50 am |
|
|
Hi folks
I am new to the CCS compiler.
I am developing some code based on a PIC18F45J10.
I literally started yesterday.
Initially I went through 'Project -> PIC wizard' to generate the defaults for the PIC.
I then went to compile to see what errors were generated and this appeared.
Code: |
***Error 144"C:\Program Files\PICC\drivers\stdlib.h" Line 1440(1,1): No valid assignment made to function pointer 456 SCR=5045
|
When I double click on this line it brings up this code below.
Code: | //---------------------------------------------------------------------------
// Searching and sorting utilities implementation
//---------------------------------------------------------------------------
typedef signed int8 (*_Cmpfun)(char * p1,char * p2);
void qsort(char * qdata, unsigned int qitems, unsigned int qsize, _Cmpfun cmp) {
unsigned int m,j,i,l;
int1 done;
BYTE t[16];
m = qitems/2;
while( m > 0 ) {
for(j=0; j<(qitems-m); ++j) {
i = j;
do
{
done=TRUE;
l = i+m;
if( (*cmp)(qdata+i*qsize, qdata+l*qsize) > 0 ) { <>line 1440<>
memcpy(t, qdata+i*qsize, qsize);
memcpy(qdata+i*qsize, qdata+l*qsize, qsize);
memcpy(qdata+l*qsize, t, qsize);
if(m <= i)
i -= m;
done = FALSE;
}
} while(!done);
}
m = m/2;
}
}
char *bsearch(char *key, char *base, size_t num, size_t width,_Cmpfun cmp)
{
char *p, *q;
size_t n;
size_t pivot;
signed int val;
p = base;
n = num;
while (n > 0)
{
pivot = n >> 1;
q = p + width * pivot;
val = (*cmp)(key, q);
if (val < 0)
n = pivot;
else if (val == 0)
return ((char *)q);
else {
p = q + width;
n -= pivot + 1;
}
}
return NULL; // There's no match
}
#endif |
Does anyone have any clues to what is going on?
I have searched the CCS forum but it seems as no one has seen this before.
The software was bought from CCS and received last friday.
PCWHD Compiler
IDE Version 4.064
PCB Version 4.064
PCM Version 4.064
PCH Version 4.064
PCD Version 4.064 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Jan 08, 2008 9:44 am |
|
|
Unfortunately, the CCS compiler, has the habit, on it's syntax checking, of reporting where it finally 'sees' the error, rather than where things first start to go wrong. So it is common, to make some small setup error, on a line in front of 'including' a file, and then have an error reported hundreds or thousands of lines 'latter' in the included file. I'd suspect that this is what is happening here. The qsort declaration, is standard, and has been identical for quite a few versions, and almost certainly does not have a problem. What is probably wrong, is that one of the lines in front of where you 'include' this is wrong. Quite possibly one generated by the wizard (it can often make some silly mistakes, if the values are not all correctly setup).
I'd look carefully at the main file immediately in front of the iclude, and if you cannot see anything wrong, post just the first lines up to this point.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
lambcutlet
Joined: 08 Jan 2008 Posts: 5
|
|
Posted: Tue Jan 08, 2008 10:02 am |
|
|
Thanks for the reply.
here is the start of the program where stdlib.h is mentioned
I commented out each line math.h, etc in turn and during the compile it always returns to Error 144.
Even if I comment out all of them except the first 2 lines and stdlib.h the error appears
Code: | #include "C:\Cprogs\Elbit\elbit_1.h"
#include "C:\Cprogs\Elbit\elbit_1_bootloader.h"
#include <math.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
//fixed hardware port locations
#byte porta = 0xF80
#byte portb = 0xF81
#byte portc = 0xF82
#byte portd = 0xF83
#byte porte = 0xF84 |
And then here is the main() section that was generated by the wizard, apart from the 2 SMBus functions at the bottom.
Code: | //BOOTLOADER AT START - Include Bootloader.h in your application - See sample application Ex_Bootload.c
//BOOTLOADER AT END - Always include the projectname_bootloader.h file in future versions of the project
// NOTE - User must include PROJECTNAME_bootloader.C in his final Application program
void application(void) {
while(TRUE);
}
void main()
{// Enter Bootloader if Pin B5 is low after a RESET
if(!input(PIN_B5))
{
real_load_program();
}
application();
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_wdt(WDT_ON);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RB);
enable_interrupts(INT_RDA);
enable_interrupts(INT_TBE);
enable_interrupts(INT_SSP);
enable_interrupts(GLOBAL);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
InternalSMBus(); //extract the info from the Fuel Gauges.
CombineSMBus(); //Combine the various FG details into a single source
} |
|
|
![](templates/subSilver/images/spacer.gif) |
lambcutlet
Joined: 08 Jan 2008 Posts: 5
|
found problem |
Posted: Wed Jan 09, 2008 10:18 am |
|
|
I found the source of my problem after pulling my hair out for most of the day.
the 'bootloader.h' file
commenting out the '#include bootloader.h' and the references in the main() section to remove the bootloader from compiling
I also removed all of the #include files apart from the one for my program and the program now compiles. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|