Psoc creator 4.1 IDE function calling problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

     I am currently working on BLE using psoc creator 4.1 IDE. The problem is if i call the function in main which function definition is in another file then

the compiler generating errors.But if i use the function definition is in the same file where function is called then it's compiling and no errors.

In my code i want to call the   send_packet();   whose function definition is in other file.

please help me to resolve the issue.

Thanks in advance.

please find the below attachment. 

0 Likes
1 Solution

The packet.c file is included badly in your project and will not be compiled.

  • Right click in workspace explorer on "packet.c"
  • choose "Remove from Design01"
  • Right click in workspace explorer on Source Files
  • choose "Add Existing item"
  • Choose in file dialog "packet.c"
  • Re-build project

Bob

View solution in original post

4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

This is a C-language problem only.

There are always two files that work together: a header file (.h) which contains only declarations and a .c file that contains the source and all definitions. The .h file is #included in the .c file and additionally wherever you need to call a function from the .c

Have a look at the generated code and understand the mechanic of th #if macro which cares that the .h file is expanded only once.

Bob

0 Likes
Anonymous
Not applicable

Thanks for reply bob

But here the problem is even if a make send_packet(); as  extern void send_packet(void);  still the problem exists.

I executed this send_packet(void);  in gcc it's working fine but in the IDE only it causes problem.

0 Likes

The packet.c file is included badly in your project and will not be compiled.

  • Right click in workspace explorer on "packet.c"
  • choose "Remove from Design01"
  • Right click in workspace explorer on Source Files
  • choose "Add Existing item"
  • Choose in file dialog "packet.c"
  • Re-build project

Bob

Anonymous
Not applicable

Thanks Bob

it's working now.

0 Likes