CC65 Question.

You need an actual VIC.

Moderator: Moderators

Post Reply
mysecretgarden
Vic 20 Newbie
Posts: 16
Joined: Thu Sep 18, 2008 2:10 pm

CC65 Question.

Post by mysecretgarden »

Hi to everyone!
I want to write my owm function to use with the CC65 compiler.
For example, if I want to include

#include <myfunction.h>

I need to write the myfunction file, with the functions signatures, and teh myfunction.c with the code implementation.

The compiler return me an error, because don't find the files myfunction.h and myfunction.c...I'm wrong?


Bye!
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

try:

#include "myfunction.h"
mysecretgarden
Vic 20 Newbie
Posts: 16
Joined: Thu Sep 18, 2008 2:10 pm

Post by mysecretgarden »

pallas wrote:try:

#include "myfunction.h"
wow!! Great!!!!

Thanks!!
User avatar
Mike
Herr VC
Posts: 4846
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: CC65 Question.

Post by Mike »

mysecretgarden wrote:For example, if I want to include

#include <myfunction.h>

I need to write the myfunction file, with the functions signatures, and teh myfunction.c with the code implementation.

The compiler return me an error, because don't find the files myfunction.h and myfunction.c...
I'm sorry to write this, but this kind of question reveals that you might be missing some really basic concepts of the C programming language.

To answer your question, an #include with a file name in angle brackets ("<" and ">") searches for the file in an implementation dependent manner. More accurately, the path to these files is supposed to contain only the ANSI headers and extra headers specific to the compiler.

If nothing other has been specified by the linker or the command line of the compiler invocation, an #include with the file name in double quotes searches in the same directory as the corresponding *.c file.

If I am right with my assumption, that you are just about to start out with C, I'd recommend you first learn it with an ANSI standard conformant compiler (cc65 only implements a subset of C). For Windows, the C/C++.net Express Edition is available from Microsoft at no cost. Otherwise, all Unix derivates always provide you with a C compiler.

K&R, The C Programming Language is still THE reference for ANSI C.

For Commodore computers, cc65 is possibly a good development tool, if the slight speed loss against pure assembly can be tolerated, and you can live with its restrictions (for example, float numbers are not supported in cc65). Using it to its full potential requires a good grasp of the idiosyncracies of the cc65 interface to the CBM KERNAL and the memory architecture of the target platform.
rhurst
Omega Star Commander
Posts: 1371
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Re: CC65 Question.

Post by rhurst »

Mike wrote:I'm sorry to write this, ...
Good stuff, Mike. All relevant info and supporting opinion, regardless the state of any underlying assumption with the poster's plea. I know I get something out of every one of your posts. :)
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Re: CC65 Question.

Post by Kweepa »

Agree with everything except this:
Mike wrote:I'd recommend you first learn it with an ANSI standard conformant compiler (cc65 only implements a subset of C).
I recommend learning with whatever helps you write the game/program you want to write, otherwise you'll lose motivation.
cc65 is sufficiently similar to C that you're not going be learning many terrible habits.
mysecretgarden
Vic 20 Newbie
Posts: 16
Joined: Thu Sep 18, 2008 2:10 pm

Re: CC65 Question.

Post by mysecretgarden »

Mike wrote:
mysecretgarden wrote:For example, if I want to include

#include <myfunction.h>

I need to write the myfunction file, with the functions signatures, and teh myfunction.c with the code implementation.

The compiler return me an error, because don't find the files myfunction.h and myfunction.c...
I'm sorry to write this, but this kind of question reveals that you might be missing some really basic concepts of the C programming language.

To answer your question, an #include with a file name in angle brackets ("<" and ">") searches for the file in an implementation dependent manner. More accurately, the path to these files is supposed to contain only the ANSI headers and extra headers specific to the compiler.

If nothing other has been specified by the linker or the command line of the compiler invocation, an #include with the file name in double quotes searches in the same directory as the corresponding *.c file.

If I am right with my assumption, that you are just about to start out with C, I'd recommend you first learn it with an ANSI standard conformant compiler (cc65 only implements a subset of C). For Windows, the C/C++.net Express Edition is available from Microsoft at no cost. Otherwise, all Unix derivates always provide you with a C compiler.

K&R, The C Programming Language is still THE reference for ANSI C.

For Commodore computers, cc65 is possibly a good development tool, if the slight speed loss against pure assembly can be tolerated, and you can live with its restrictions (for example, float numbers are not supported in cc65). Using it to its full potential requires a good grasp of the idiosyncracies of the cc65 interface to the CBM KERNAL and the memory architecture of the target platform.
Mike, thank you for your answer, but the question is smaller than your answer. I simply ask a little question about the include directive, I'm c# programmer, I simply forget how this directive work because the C ansi is not my language!
Post Reply