GLBasic forum

Main forum => Bug Reports => Topic started by: AlienMenace on 2011-Mar-01

Title: Not seeing loaded source file
Post by: AlienMenace on 2011-Mar-01
Not sure why this happening but sometimes when I add a source file with functions, the main programs claims not to be able to see them and throws a ( 8 ) error : call to undefined function : error. The same exact include file in another project works just fine.
Title: Re: Not seeing loaded source file
Post by: Kitty Hello on 2011-Mar-01
yre you sure you have that file in the files tab?
Title: Re: Not seeing loaded source file
Post by: AlienMenace on 2011-Mar-01
Yes, it's there as a tab. I checked the project file as well in wordpad and it shows the file listed there as a source file as well. I've also had situations where a source file's functions worked fine in one program but failed when called the exact same way in another program.
Title: Re: Not seeing loaded source file
Post by: MrTAToad on 2011-Mar-01
Could you make the project and files available ? I suspect its due to the order that the files are compiled...
Title: Re: Not seeing loaded source file
Post by: AlienMenace on 2011-Mar-16
It happens every time I try to add a new source file, then copy code into the new tab then save all. It does not see the new source file even though it is listed in the tabs and the code is there when you click on it. It happens every time I try to do this. I even check the project file and both the main and the added source file are there but glbasic complains that the functions does not exist.
Title: Re: Not seeing loaded source file
Post by: backslider on 2011-Mar-16
Is the function highlighted when you use it in another file?
Title: Re: Not seeing loaded source file
Post by: AlienMenace on 2011-Mar-16
Yes, but even when it is highlighted, it is still a problem.

When I load this project, the sayhello() function call in the  Test.gbas tab of the editor is white, if I then click on the Hello.gbas tab then click anywhere in the pane then click back to Test.gbas, the sayhello() function call turns purple. It makes no difference though, it still errors out.

(http://i275.photobucket.com/albums/jj282/gulfracer/testissue.jpg)
Title: Re: Not seeing loaded source file
Post by: Kitty Hello on 2011-Mar-16
are you switching to the "variables" view in the side bar?
Title: Re: Not seeing loaded source file
Post by: MrTAToad on 2011-Mar-16
Is the file included in the project ?
Title: Re: Not seeing loaded source file
Post by: bigsofty on 2011-Mar-16
Quote from: MrTAToad on 2011-Mar-16
Is the file included in the project ?

My thoughts exactly.
Title: Re: Not seeing loaded source file
Post by: Slydog on 2011-Mar-16
Quote from: MrTAToad on 2011-Mar-01
I suspect its due to the order that the files are compiled...

Me too.
Edit the 'Test.gbap' file in Notepad.  (or whatever your project '.gbap' file is called)
You should see the following near the end of the file:

Code (glbasic) Select
   <SRCFILES >
      <FILE PATH=".\Test.gbas" />
      <FILE PATH=".\Hello.gbas" />
   </SRCFILES>


Try reversing the two lines starting with <FILE PATH.....> and save it, then reload the project and try that.
ie. change it to this:
Code (glbasic) Select
   <SRCFILES >
      <FILE PATH=".\Hello.gbas" />
      <FILE PATH=".\Test.gbas" />
   </SRCFILES>


The order may matter in your case, as I need to do this quite often by putting the source file with a function above any other files that call that function.  (Or it may be just TYPES or GLOBALS that require this, not sure)

BUT, if you don't see both files between the <SRCFILES> tags, then your problem is what the others are saying.   You need to add the 'Hello.gbas' file manually to your project (ie: right-click in the 'Files' area on the right and select 'Add File'.)  Because you can edit the file doesn't mean the file is part of the project perhaps.
Title: Re: Not seeing loaded source file
Post by: Kitty Hello on 2011-Mar-16
if you right click a file in the files-pane, you can select "Make Main Program" - That does the swap.
Title: Re: Not seeing loaded source file
Post by: AlienMenace on 2011-Mar-21
I added it in the file paned and it works now but when I viewed the project file in notepad it was listed there before that. Weird. I thought that if you add it from the file menu that would have been enough. Seems to me to be a little counterintuitive to have to add it to the project again.

Thank you.