'Include' vs. 'Add file to project'

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
jmusselman64
Posts: 31
Joined: 15 May 2018 21:05

'Include' vs. 'Add file to project'

#1 Post by jmusselman64 » 12 Aug 2018 22:30

The title somewhat says it all.

What is the difference between these two?

I'm having difficulty understanding scope and visibility of 'files in project' versus 'included' files.
I have read the 'scope and visibility' section in the 'Help' file as well.

Example: If I have a variable defined in the 'global' section of a module, I would expect it to be visible to the entire project.
Doesn't seem to work that way. If I 'add' the file to the project, then it works, but that seems to defeat the purpose of making re-usable modules.

I'd attach an example, but my motherboard abruptly died yesterday and access to everything is on hold till the replacement arrives.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: 'Include' vs. 'Add file to project'

#2 Post by Dany » 13 Aug 2018 11:03

Perhaps this can help: https://libstock.mikroe.com/projects/vi ... ke-process
p.s. for mB you should read "include "xxx"" in stead if "uses xxx" in the article.

Adding a file to the project (in the project manager) does no make them visible to all other modules in the project, only include statements do that.
An important exception: adding a file to the project causes an automatic "uses" of it in the main project file (which should not happen actually).
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: 'Include' vs. 'Add file to project'

#3 Post by petar.suknjaja » 14 Aug 2018 07:57

Thanks, Dany, I really appreciate your contribution here on the forum.
Kind regards,
Petar

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”