Shop OBEX P1 Docs P2 Docs Learn Events
external files in simpleIDE — Parallax Forums

external files in simpleIDE

zorasterzoraster Posts: 10
edited 2013-08-07 10:37 in Propeller 1
I want to break up a file for running a 2 line lcd display into separate files but I not sure how to do it. Is it done by creating .h files and prototypes?

Comments

  • jazzedjazzed Posts: 11,803
    edited 2013-08-07 09:52
    Short answer: Yes.

    Long answer: Consider the libfdserial example with this list of todos:
    • Best to use Project View for this.
    • Create one .h header file for prototypes.
    • Wrap the .h file content with #ifndef, #define ... #endif
    • Put functions in separate .c files.
    • Include .h file in the .c files
    • Add .h and .c files to project manager.
    Some of these details may require explanation. Don't hesitate to ask. I'll do my best to answer.

    There is also a description of creating a library in the new 0-9-40 user guide.
  • tdlivingstdlivings Posts: 437
    edited 2013-08-07 09:59
    Steve
    Why do you say add .h files to project manager.
    I have been only adding a file link to the .c files who all have included there
    .h file which is in the same folder as the .c file.

    Are you meaning to say add a path to the .h files that are in a seperate folder
    from the .c files.

    Tom
  • jazzedjazzed Posts: 11,803
    edited 2013-08-07 10:37
    Good question Tom.

    Adding a .h file to the project manager ensures that it will get archived (zipped) with a project when you zip it. Not all files in the current project folder get zipped ....

    The Simple Library .h files (like #include "simpletext.h") do not need to be added to the project manager since they are part of pre-compiled libraries found in the Learn/Simple Libraries folder. Pre-compied libraries, sources, and documentation will be zipped with a project if they detected by auto-lib or by including the library in the project manager. When a library is included in the project manager the -I and -L flags tell the IDE where to find things. if you add libraries outside of the Simple Library folder, you need to add them to the project. Including "Simple Libraries" in a project is less important now that auto-lib works so well.
Sign In or Register to comment.