Hello everybody,
Please excuse my newb question. The problem I am having is that I can't seem to call functions defined in external files. At the moment, in order to try and do so, I am using the following structure:
In "Main.c"
---------------------------------------------------------------
#include "header_file.h"
/*call function*/
<r-type> <function_name> ();
---------------------------------------------------------------
In "header_file.h"
--------------------------------------------------------------
/*function prototype*/
<r-type> <function_name> (<p-type> <p-name>)
--------------------------------------------------------------
In "file_containing_function.c"
-------------------------------------------------------------
/*define function*/
<r-type> <function_name> (<p-type> <p_name>)
{
some_code;
}
-------------------------------------------------------------
-------------------------------------------------------------
The main.c file obviously already exists, however I have added both the "header_file.h" containing the function prototype; and the "file_containing_function.c" which defines my function to my project. Can somebody please explain to me why when in debug mode, I cannot view the 'stack crawl window' step through the function in the external file. It simply seems to bypass the function call altogether.
Thanks for your help.
Solved! Go to Solution.
Hello
First I assume there is a typo in your initial post. Content of main.c should read as:
In "main.c"
---------------------------------------------------------------
#include "header_file.h"
<r-type> retval;
/*call function*/
retVal = <function_name> ();
---------------------------------------------------------------
Then next question is which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
To retrieve that info:
- Start CodeWarrior
- Select Help -> About Freescale CodeWarrior
- Click on "Install Products"
- CodeWarrior version used is displayed on top in the Installed Products dialog.
Finally did you enable generation of debug information on file_containing_function.c?
Please check FAQ-27442 on www.freescale.com for more details on how to figure that out.
CrasyCat
Hello
First I assume there is a typo in your initial post. Content of main.c should read as:
In "main.c"
---------------------------------------------------------------
#include "header_file.h"
<r-type> retval;
/*call function*/
retVal = <function_name> ();
---------------------------------------------------------------
Then next question is which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
To retrieve that info:
- Start CodeWarrior
- Select Help -> About Freescale CodeWarrior
- Click on "Install Products"
- CodeWarrior version used is displayed on top in the Installed Products dialog.
Finally did you enable generation of debug information on file_containing_function.c?
Please check FAQ-27442 on www.freescale.com for more details on how to figure that out.
CrasyCat
Thanks CrasyCat for correcting my syntax. Problem solved.