This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Trying to debug include files

i have a main program with some include files, and i want to debug this files as well as the main program and use breakpoinds.
Anyone knows how to do this???
Thanks

Parents
  • Javier,

    At the top of all the files OTHER than main that use these variables, you must put an "extern" declaration to let the linker know where to find these variables. For instance, if you had an integer variable named "var1" in main.c that you wanted to use in foo.c, then somewhere at the top of foo.c you would put:

    extern int var1

    That being said, it's becoming quite clear that you've never done any C programming before. Let me be the first to suggest that a microcontroller platform is NOT the place you should learn how to do so.

Reply
  • Javier,

    At the top of all the files OTHER than main that use these variables, you must put an "extern" declaration to let the linker know where to find these variables. For instance, if you had an integer variable named "var1" in main.c that you wanted to use in foo.c, then somewhere at the top of foo.c you would put:

    extern int var1

    That being said, it's becoming quite clear that you've never done any C programming before. Let me be the first to suggest that a microcontroller platform is NOT the place you should learn how to do so.

Children
  • At the top of all the files OTHER than main that use these variables, you must put an "extern" declaration

    No. As I keep pointing out, pretty much every occurence of the word 'extern' in a .c file is a design error.

    You should have this 'extern' in a header file instead, and #include that in exactly those source files that refer to it, including the one that holds the definition of the variable in question.

  • At the top of all the files OTHER than main that use these variables, you must put an "extern" declaration

    No. As I keep pointing out, pretty much every occurence of the word 'extern' in a .c file is a design error.

    You should have this 'extern' in a header file instead, and #include that in exactly those source files that refer to it, including the one that holds the definition of the variable in question.

  • Hans,

    While I understand your philosophy, keep in mind that Javier started off this thread by asking how he could STEP THROUGH CODE included in a header file. I'm just going for simplicity here at the moment. He'll learn the theology of things the hard way at some later date, no doubt.