Function Call using a separate Name.c and Name.h Files

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

cross mob
PhBe_1305961
Level 3
Level 3
First like received First like given

I am new to software programming, so please frame your help response with that in mind.  My problems is:

   

I have taken example projects code which has Functions defined in separate Named.c files containing the Function code. I have made modification to them and all works fine.

   

I have made up new Function Calls and Function Code within the main.c file and call them within the main for loop and all works fine.

   

When I take the same Function Calls and create separate .c and .h files and call them, I get the error : Build error: The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.   I have look at the .c and .h files for the external Function Calls that work and have, as far as I can tell, duplicated all the required #includes and void Name (void); entries .

   

Is there some typical step a newbie like me might not be doing beyond creating the files and trying to build?      

0 Likes
2 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        Such error often arises if a define is placed in *.H file, e.g. uint8 myVar=1; (can't do =1 here, only in *.C) Please post your project to have better response: File->Create archive bundle->Minimal.   
0 Likes

Thanks !!  You hit the nail on the head.  I had exactly what you showed.  

   

Sorry for not responding sooner. Been down with a bad Flu since new years eve.    

0 Likes