News:

Let's find out together what makes a PIC Tick!

Main Menu

Includes pathname

Started by SCV, Feb 03, 2021, 11:09 AM

Previous topic - Next topic

SCV

Is there a method to point to an include file via a specific path outside the normal path options?


Tim.

rick.curl

Hi Tim-
You can always put the path in the line where you call the include:
Include "C:\Users\Rick\my includes\whatever.inc"
Does that help?

-Rick

SCV

Thanks for the quick reply, I had tried that - however I left the .inc off! now working  :)

top204

The compiler needs the file prefix because a lot of people use ".bas" for include files. This is perfectly acceptable and the compiler will accept any file prefix.

HAL

Hi
I was wondering about the difference between .inc and .bas, as include files and just got an answer to my unasked question (not including rarely asked questions).  One can learn by browsing the forum....
Take care
HAL

joesaliba

Quote from: rick.curl on Feb 03, 2021, 12:41 PMHi Tim-
You can always put the path in the line where you call the include:
Include "C:\Users\Rick\my includes\whatever.inc"
Does that help?

-Rick

Proton Studio do that automatically. However, Proton Studio only allow .inc and .bas files.

I have seen an example and they used .h as an extension. PDS IDE accept this .h, but Proton Studio not.

So as a standard I only use .inc or .bas

top204

#6
The only difference between a .bas and .inc file is the extension naming. However, the compilers will not compile a program that does not have a .bas extension.

Generally, the .bas file holds the main program code listing and the .inc files hold the libraries or subroutines that are included into the main program. This allows the clearer identification of files. In a language like C, it is the file extensions ".c" and ".h" that have the same meaning as ".bas" and ".inc"

I started doing this, way back when, when I first started coding using assembler, where the main code block was .Asm and the include files were .inc types. This allowed me to locate any macros or subroutines I had created to work with the asm file, so I could use them with other progams.