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 CCS Technical Support

Function Used but not defined

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



Joined: 15 Jan 2019
Posts: 22
Location: Sweden

View user's profile Send private message

Function Used but not defined
PostPosted: Tue Jun 15, 2021 3:19 am     Reply with quote

Hello a quick question before I post more code.
Compiler 5.076 PIC30F4011

I am up to convert a C file for a Analog DDS chip from Linux C to CCS C.

Almost done but
I got "not defined error" when I try to use a function from the external c file, I do have the same header file included in main and the header also contains function declarations for all functions.

In CCS explorer the C file I have included into the project is blue in color.
If I hover over it and check information it says "Not used in last build".
Is that why it is blue ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Tue Jun 15, 2021 7:16 am     Reply with quote

OK.
What you are trying to use is almost certainly from a traditional 'linking'
compiler. The standard way that C works on such a compiler is that you
include the 'header' file, and then at compile time, 'link' the already compiled
code for this. Now you can use CCS like this. However you are then going
to have to build each of the parts separately, and have a file to #import
each of the .o files for the compiled sections. Until they are imported the
compiler will keep complaining that the function definition does not exist.
By default, CCS is normally used with only one compilation unit. Instead
of building with MCU's like this, you instead actually #include the real .c file
for the other units and let the compiler compile all of them. The big advantage
of this is that it allows the compiler to better optimise memory usage.
PeWa



Joined: 15 Jan 2019
Posts: 22
Location: Sweden

View user's profile Send private message

Function Used but not defined
PostPosted: Tue Jun 15, 2021 12:32 pm     Reply with quote

Ttelmah, thanks for input.

I have fixed it, some time it is worth taking a pause and come back to the code.

The problem was that I had only the header file included in main
but the .c file and header file was included in the project.

When I included the .c file to main i had to get rid of the header and use that only in the .c file for that header.

The blue color means not compiled with project then.
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