GLBasic forum

Main forum => Bug Reports => Topic started by: Slydog on 2011-Mar-18

Title: Reordering of <SRCFILES > list when compiling
Post by: Slydog on 2011-Mar-18
Here's the <SRCFILES> section of my project file (.gbap), which was manually ordered:
Code (glbasic) Select
   <SRCFILES >
      <FILE PATH=".\MazeBall.gbas" />
      <FILE PATH=".\__LIB\_Common.gbas" />
      <FILE PATH=".\__LIB\_File.gbas" />
      <FILE PATH=".\__LIB\_Font.gbas" />
      <FILE PATH=".\__LIB\_gCamera.gbas" />
      <FILE PATH=".\__LIB\_gEntity.gbas" />
      <FILE PATH=".\__LIB\_gMesh.gbas" />
      <FILE PATH=".\__LIB\_gShader.gbas" />
      <FILE PATH=".\__LIB\_gSprite.gbas" />
      <FILE PATH=".\__LIB\_GUI.gbas" />
      <FILE PATH=".\__LIB\_gVector.gbas" />
      <FILE PATH=".\__LIB\_Input.gbas" />
      <FILE PATH=".\__LIB\_Sound.gbas" />
      <FILE PATH=".\__LIB\_Tween.gbas" />
      <FILE PATH=".\__Menus\Menu_Main.gbas" />
      <FILE PATH=".\__Menus\Menu_World.gbas" />
      <FILE PATH=".\__Menus\Menu_Level.gbas" />
      <FILE PATH=".\__Menus\Menu_Play.gbas" />
      <FILE PATH=".\__Play\Play_Maze.gbas" />
      <FILE PATH=".\__Play\Game_Over.gbas" />
      <FILE PATH=".\LevelDraw.gbas" />
      <FILE PATH=".\LevelMain.gbas" />
      <FILE PATH=".\Maze.gbas" />
      <FILE PATH=".\Gizmos.gbas" />
      <FILE PATH=".\_Main.gbas" />
   </SRCFILES>


But, whenever I recompile in the latest version of GLBasic [ver 9.033] it immediately sorts those entries by file name (ignoring the folder name) and resaves the .gbap project file's <SRCFILES> section as:
Code (glbasic) Select
   <SRCFILES >
      <FILE PATH=".\MazeBall.gbas" />
      <FILE PATH=".\__LIB\_Common.gbas" />
      <FILE PATH=".\__LIB\_File.gbas" />
      <FILE PATH=".\__LIB\_Font.gbas" />
      <FILE PATH=".\__LIB\_gCamera.gbas" />
      <FILE PATH=".\__LIB\_gEntity.gbas" />
      <FILE PATH=".\__LIB\_gMesh.gbas" />
      <FILE PATH=".\__LIB\_gShader.gbas" />
      <FILE PATH=".\__LIB\_gSprite.gbas" />
      <FILE PATH=".\__LIB\_GUI.gbas" />
      <FILE PATH=".\__LIB\_gVector.gbas" />
      <FILE PATH=".\__LIB\_Input.gbas" />
      <FILE PATH=".\_Main.gbas" />
      <FILE PATH=".\__LIB\_Sound.gbas" />
      <FILE PATH=".\__LIB\_Tween.gbas" />
      <FILE PATH=".\__Play\Game_Over.gbas" />
      <FILE PATH=".\Gizmos.gbas" />
      <FILE PATH=".\LevelDraw.gbas" />
      <FILE PATH=".\LevelMain.gbas" />
      <FILE PATH=".\Maze.gbas" />
      <FILE PATH=".\__Menus\Menu_Level.gbas" />
      <FILE PATH=".\__Menus\Menu_Main.gbas" />
      <FILE PATH=".\__Menus\Menu_Play.gbas" />
      <FILE PATH=".\__Menus\Menu_World.gbas" />
      <FILE PATH=".\__Play\Play_Maze.gbas" />
   </SRCFILES>


The problem is that I NEED the files to be compiled in a specific order or I get errors when declaring variables of a TYPE that was defined in another project file later in the compile order.  The solution for that error that worked for me was to ensure that the file defining the TYPE was always before any files that declared variables of that TYPE.
Oh, and this isn't a problem with my version 8 GLBasic.

I guess a work around would be to name files alphabetically by the order I want them compiled!  :blink:
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: Slydog on 2011-Mar-18
I just noticed in the GLBasic Logfile:
Code (glbasic) Select
// 9.033
...
   // Editor:
   //    Sorting project files by file name now.


Is that why I'm having my problem?
The compile order is now based on file name sorting?
Was there a reason this was changed?

I also notice the File pane in GLBasic has them sorted the same way!  (Was this why?!)
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: Kitty Hello on 2011-Mar-18
make an example where you have the trouble and I will have to fix it.
So far, rename the src files :S
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: Hark0 on 2011-Mar-19
Quote from: Kitty Hello on 2011-Mar-18
make an example where you have the trouble and I will have to fix it.
So far, rename the src files :S

... or declare ALL vars/types/global in first/main GLB... ;)
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: MrTAToad on 2011-Mar-19
Globals are the work of the Devil!
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: AlienMenace on 2011-Mar-21
I think having to use additional local variables to ultimately set a single global variable is the work of the devil. :)
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: Kitty Hello on 2011-Mar-22
In order to avoid global variables do:


Code (glbasic) Select

// old code, no, kitty, no bite!
GLOBAL gf AS Tfoo
gf.bar()

// new code, purr, kitty, purr
FUNCTION gf AS Tfoo:
STATIC f as Tfoo
RETURN f
ENDFUNCTION

gf().bar()


The advantage is, that you can use it as if it was a global, you can ALIAS it and you can declare that in another gbas file with no "UNDECLARED" error message.

Title: Re: Reordering of <SRCFILES > list when compiling
Post by: Slydog on 2011-Mar-22
I reinstalled 9.006 and the problem is gone, again.
This computer is at my work, and to install a newer version (update firewall issue?) I have to manually download the update package and manually install it.
I may have manually installed it wrong, or the update expected another update to be installed previously?

If / when I upgrade, I guess I'll just rename the files to be compiled alphabetically.
Title: Re: Reordering of <SRCFILES > list when compiling
Post by: MrTAToad on 2011-Mar-22
The sorting was added in 9.033