Compile Errors

Started by JR Heathcote, June 27, 2006, 02:40:06 PM

Previous topic - Next topic

JR Heathcote

To all,

Ran into a problem this morning which I'm sure is quite simple to solve, but has me somewhat baffled.  I tried compiling my app this morning and it is now generating a "Missing declaration" compile error, however, the variable I'm attempting to reference IS declared in my source code only in another module.  The only thing I can think of is FireFly is not placing the file containing the variable declaration ahead of the source code file that references the offending variable.  If this is the case how do I control the order in which modules are loaded within a Firefly project?  Place the modules in the proper order in an INCLUDE file?  Sounds reasonable, but where in the Firefly project would one place such an INCLUDE file and not screw up everything else?

Module load order also sounds like a wish list item to me.

The reason I'm using INCLUDE files is to load other source code modules that  have already been debugged, so I didn't see the need to load them inside of the Firefly project.  I guess I could load these modules in the Firefly project, but moving between a large number of source code modules in the editor using the tab control is very klunky indeed.  So another wish list item I would like to see is a method to quickly move between many source code files in a project, say possibly using the ListBox or TreeView control for this.

Probably won't make it to Firefly 3.0, so I'm shooting for 3.5, just a thought.

JR

TechSupport

Quote from: JR HeathcoteThe only thing I can think of is FireFly is not placing the file containing the variable declaration ahead of the source code file that references the offending variable.  If this is the case how do I control the order in which modules are loaded within a Firefly project?
You are most likely correct. There is currently no simple way to dictate the ordering of the modules/forms. This is certainly on the to-do list for the next version.

FireFly attempts to do "forward referencing" (a feature that I wish that the compiler took care of). Basically, FireFly will navigate through your entire project and create the declares for all subs/functions, equates, types, macros. It then places them in a separate include file at the top of your project. FireFly does not parse embedded #Include statements so that's why you may be seeing the declaration error. To be sure that FireFly will parse the file, you simply include it in the project as a module.

QuoteI guess I could load these modules in the Firefly project, but moving between a large number of source code modules in the editor using the tab control is very klunky indeed.
This seems to be a common mistake that users make. You do not have to have every Form/Module open in the tab control. In my projects, I only have one or two Forms open and maybe a couple of Modules. This gives you the benefit of much faster project loading and easier navigation. I keep my mostly used Forms/Modules open in the tab control. To quickly close an open Form/Module, right-click on the Tab and select "Close Form". Don't select "Remove Form" because that will unload the Form from the entire project.

QuoteSo another wish list item I would like to see is a method to quickly move between many source code files in a project, say possibly using the ListBox or TreeView control for this.
So, what's wrong with the "Project Explorer" on the "FireFly Workspace" window??? All of the Forms/Modules are organized using a Treeview. Double-click on the Form/Module name to load it into the Tab Control.

JR Heathcote

Quote
So, what's wrong with the "Project Explorer" on the "FireFly Workspace" window??? All of the Forms/Modules are organized using a Treeview. Double-click on the Form/Module name to load it into the Tab Control.

Nothing, as far as it goes.  But it would be nice if the FireFly workspace window always remains visible or at least be a user configurable option to do so.  When I double click on a module the FireFly workspace window disappears.  It only reappears when I click on Form Designer tab.  The disappearing/reappearing workspace window makes it somewhat inconvenient to use Explorer as a basic navigation tool IMHO.

Also, why not load the procedure/MACRO names at a level beneath the filename in Explorer?  Click on a procedure name and it loads the module in the editor and sets the caret to that procedure, this would certainly make project navigation easier to accomplish.  I would also tend to think the user would get more of a complete overview of the modules and procedures in their project if procedure/MACRO information were presented in the Explorer.

Again, just a thought.

JR

TechSupport

Quote from: JR HeathcoteBut it would be nice if the FireFly workspace window always remains visible or at least be a user configurable option to do so.
:) That option is in the "Options".
- Environment Options
- General
- Code Editor
- Uncheck the option "Auto hide FireFly Workspace when in Code Editor"
Quote
Also, why not load the procedure/MACRO names at a level beneath the filename in Explorer?  Click on a procedure name and it loads the module in the editor and sets the caret to that procedure, this would certainly make project navigation easier to accomplish.  I would also tend to think the user would get more of a complete overview of the modules and procedures in their project if procedure/MACRO information were presented in the Explorer.
I hear ya, 110%. That is currently my biggest beef with FireFly - navigation among the subs/functions within the Project. I am writing FireFly 3 using FireFly 2. The number of subs/functions has grown so large that trying to track down a specific function can be aggravating. :) This will be much better in FireFly 3.

JR Heathcote

Well, Firefly compiling modules out of order is really putting a crimp on my production.  How does Firefly determine the order in which to compile project modules anyway?  From the *.PRJ file?

As I see it I have two options, (1) create a single project module then include all of my modules in the order I want them compiled, or (2) figure out how Firefly determines compile order and alter that.

JR

TechSupport

FireFly simply reads the project file and puts the module names into an array (it is a linked list of objects in FireFly 3). During code generation, the module array is read and the string created listing the "Includes".

I like your idea #1. Create one module and use #Include statements in that module to be in the list order that you need. I guess that you can manually modify your project file to put that module first in the list. That would ensure that it gets outputted first in the code generated list.

Please let me know how you progress with this. I am reluctant to have to make any major changes to the FireFly 2 code base, but if we can't find an "easy" solution to your problem then I'll certainly have to make the changes.

JR Heathcote

Paul,

Thanks for the offer.

I kinda figured that the files in the *.PRJ file is the order they are compiled.  It looks like this list, for the most part is sorted alphabetically which definitely causes the problem.  Couldn't this list be reordered, thus controlling the order the modules are compiled?

Right now I'm trying option #1.  The down side is I need another editor open besides Firefly so I can edit the modules external to the project.  I hope module ordering will be an integral part of Firefly 3.0.

Will let you know how successfull this effort is.

JR

TechSupport

I am now working on a better fix. I will modify the code generation process to look for a special text file.... say, "USER_INCLUDES.INC" or something similar. I will code output an Include right after the Win32API.inc file. The code will output something like the following:

#Include "Win32API.inc"
#Include "User_Includes.inc"


You can manually edit the "User_Includes.inc" to order your external includes how you want them. You won't have to have those includes included in the Project itself. This should have the added benefit of allowing your project to load a little faster.

JR Heathcote


TechSupport

Okay, I have made the change.... give it a try to see if it actually works as you expect. The user editable file must be called "User_Includes.inc" and must be placed in the Project's directory.

http://www.planetsquires.com/files/FFengine.zip

Please let me know if it works. :)

JR Heathcote

Does this fix create the DECLARE's or do I need to do that myself?

JR

TechSupport

You would need to deal with the DECLARES yourself for any of the Includes that you have listed in the User_Includes.inc file. FireFly just basically takes the contents of that file and pastes it into the WinMain portion of the generated code. It does no other processing on it.

JR Heathcote

Paul,

OK, I will create the DECLARE's myself.

You're right, forward referencing in PB would certainly solve a lot of problems.

Thanks again!

JR

JR Heathcote

Paul,

Just got my project rebuilt using "User_Includes.inc" and this appears to have solved the problem.  The necessary system modules are compiled before the computational code so the missing reference error message does not appear when compiling.

Just to let you (and other) know I didn't put every source code module in "User_Includes.inc", only the UDT's, modules, and MACRO's that the bulk of my app references.  So unless someone has a special need to put all modules in "User_Includes.inc" I would suggest only the dependent source code should be put in this file.  

Your fix appears to be a workable solution until 3.0 makes its' appearance.

Thanks for the quick response.

JR

John Montenigro

Quote from: JR Heathcote
...
Just got my project rebuilt using "User_Includes.inc" and this appears to have solved the problem.  
...

Would you (or anyone else) be willing to provide a snippet to show the format and content for the User_Includes.inc" file?

I gather that FF will detect the existence of the file, and that we don't have to add it as a module or check any checkboxes...?

Thanks,
-John