CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Linker Problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
paulsherman



Joined: 06 Aug 2004
Posts: 1

View user's profile Send private message

Linker Problem
PostPosted: Fri Aug 06, 2004 8:40 am     Reply with quote

Hi

I have the compiler CCS PCH C Compiler version 3.180 and I am using it with MPLAB IDE v6.30 and have the following problem.

When I come to build the file it says that I am calling a function that is undefined. I have checked and the procedure is there and its header file is included. I know that it is picking it up from the header file because if I remove the include statement the error comes sooner with a slightly different message saying undefined identifier.

It seems to be just compiling the first file in the project and building the single file. It doesn’t seem to be compiling all of the files then linking them.

Can someone please tell me what I am doing wrong. Do I have to create my own linker file.

Sorry if this is a bit basic, but I have been used to using MSVC++ and having all of this created for me.

Thanks in advance

Paul
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Aug 06, 2004 8:57 am     Reply with quote

I would guess your trying to use the function before the compiler has seen it. It is all serial. (The compiler that is) If your using it in the main program, but it is physicaly after the main,... this is your problem.
Try using a prototype.
Thats how I get around this problem.

And note that I don't think this is a real "problem"/"bug",.. I think most compilers will do this.

I can't help you any more, without seeing your code.
here is my example

Code:

//---------------- Prototypes--------------------
void ChkErr(void);            //print out any errors that occured

//---------------- MAIN --------------------
void main(void)
{
init:
  disable_interrupts(GLOBAL);
  setup_adc_ports(NO_ANALOGS);
//========forever loop========
  while(1)
  {
    ChkErr();
  }//end while(1)
}//end main
//////////////////////////////////////////////////////////////
////////////////////// Subroutines ///////////////////////////
//////////////////////////////////////////////////////////////
//========= err_chk ===========
void ChkErr(void) //print out any errors that occured
{
  int8 chk=0;
  if (ERRORS==0){return;} //if no errors jump right back out
  for(chk=0;chk<16;chk++)
  {
    if (bit_test(ERRORS,chk))
    {
      bit_clear(ERRORS,chk);
      fprintf(STDERR,"ERROR(%U): %s.\r\n",chk,error_txt[chk]);
      tx_buffer(NACK,sizeof(NACK));
      rx_indx_i=rx_indx_o=0;
    }
  }
}

Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Aug 06, 2004 10:48 am     Reply with quote

CCS does not compile files separately like what you are use to. You have to include the C files in the main file.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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