Not seeing loaded source file

Previous topic - Next topic

AlienMenace

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.
Apps published: 3

Kitty Hello

yre you sure you have that file in the files tab?

AlienMenace

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.
Apps published: 3

MrTAToad

Could you make the project and files available ? I suspect its due to the order that the files are compiled...

AlienMenace

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.
Apps published: 3

backslider

Is the function highlighted when you use it in another file?

AlienMenace

#6
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.

Apps published: 3

Kitty Hello

are you switching to the "variables" view in the side bar?

MrTAToad

Is the file included in the project ?

bigsofty

Quote from: MrTAToad on 2011-Mar-16
Is the file included in the project ?

My thoughts exactly.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Slydog

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.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

if you right click a file in the files-pane, you can select "Make Main Program" - That does the swap.

AlienMenace

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.
Apps published: 3