- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bob
it's working now.