Post Reply 
HPGCC 2.0 and Programmer's Notepad
04-05-2017, 12:54 AM (This post was last modified: 04-06-2017 08:56 PM by brickviking.)
Post: #5
RE: HPGCC 2.0 and Programmer's Notepad
(04-04-2017 04:44 PM)Helix Wrote:  
(04-04-2017 03:44 AM)brickviking Wrote:  I'm assuming here that you've used #include "myfile.h" in your myfile.c and put the myfile.h in the same directory?

Yes, I've done that. In fact, I may have found what happens: in the Egan Ford's tutorial (that I don't follow because it is too overwhelming for a beginner like me) I read in the Makefiles section:
"The Makefile in ~/hpgcc/test is a Makefile I modified from the HPGCC distribution. This Makefile is all you need if you are developing single source file binaries using only HPGCC supplied libraries."

So, if I understand correctly, it is not permitted to split the source code into several files, hence the compiling error.

The Windows package I use also relies on a Makefile. I don't know what a Makefile is, and I don't understand its contents, but it certainly reproduces the behavior described in the Egan Ford's page.

If you find the Egan Ford tutorial too overwhelming, find a more "basic" tutorial that you do understand. Compiling a C program (and the same holds for C++) goes through a few stages.
    * Make:
      *A Makefile gets fed to a command called make (appropriately enough). It's basically a list of files and the requirements to create those files. make runs the rest of the compiling process and coordinates what bits can go where.
    * Preprocess:
      * read the *.c files, find out what *.h files need to be added, and include their contents directly in the preprocessor output.
    * Compile:
      *turn C code from preprocessor into assembler code.
      * In modern compilers, the compile phase often produces binary code directly, omitting the next stage.
    * Assemble (in older compilers, or when specifically selected):
      * turn the assembler code into binary code (in libraries in some cases).
    * Link:
      * final stage, where function code from libraries and assembler output gets collected together into a binary file. The output file can then be executed directly by the OS, or in the case of some embedded solutions, directly on the CPU.

There are far better explanations than this, but this'll get you at least started. And yes, you'll have to get to grips with the concepts at least. C is a rewarding language, but does take some learning, you'll also want to look up what makes a Makefile special.

EDIT: Modified original post to indicate Bob's understanding.

(Post 60)

Regards, BrickViking
HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
HPGCC 2.0 and Programmer's Notepad - Helix - 04-03-2017, 12:19 AM
RE: HPGCC 2.0 and Programmer's Notepad - brickviking - 04-05-2017 12:54 AM

User(s) browsing this thread: 1 Guest(s)