It is currently Fri May 24, 2013 2:10 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 7:06 am 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
It gives the error message:

[COMPILER] Line 11: Window_Main() is not a function, array etc

There is nothing at line 11

Window_Main() is called later than line 11

;- Main Loop
If Window_Main()

Note that PB will compile and run ok
Note also that jaPBe will create the executable !!


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 7:30 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2863
Location: Wales, UK
Not really enough info to guide you. Does your code consist of more than one source file? If so, you need to declare your Procedures. Watch out for typos too.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 9:30 am 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
yes - more than one source file.

But how can it be that PB will compile and run ok but not create the .exe ??

Also jaPBe will create .exe ok !!


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 10:00 am 
Offline
Addict
Addict

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1460
Neil wrote:
how can it be that PB will compile and run ok but not create the .exe ??

The compiled (or temp) exe is not (by default) in the same folder as the created exe, so that's where to start investigating. Try changing the folder in the Prefs that specifies where temp exe is created, and see what you can come up with. Also, try disabling your virus-checker to see if that's causing the problem, because it may not be scared off a temp exe, but will freak out with the real exe.

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 11:30 am 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
Change location of temp.exe - no difference.

Note that jaPBe will create the .exe ok so nothing to do with virus checker.

And why does the error message point to a meaningless line number ??


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 12:26 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
Add
Code:
Declare Window_Main()
on the top of your source!

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Mageia 3 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 1:31 pm 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
Nup - still no luck !!


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Fri Mar 16, 2012 1:54 pm 
Offline
User
User

Joined: Mon Jul 09, 2007 4:47 pm
Posts: 67
Location: Right Here
Submit a code snippit which demonstrates the behavior.

Usually, creating one leads to the solution of the problem.


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Sat Mar 17, 2012 3:42 am 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
Good suggestion !!

I was thinking of doing this but there are about 6 files in project.

I then started trimming them out - i.e. only using the ones I require to generate the window/form.

I have now found what is causing the problem, but I cannot see the reason !!

The 3 key files were created by PureVision:

AvevaLauncher.pb
AvevaLauncher_Constants.pb
AvevaLauncher_Windows.pb

If I keep the files separate as per attached code, I get the error.

If I include the code for AvevaLauncher_Windows.pb in AvevaLauncher.pb I don't get the error !!

Code:
;AvevaLauncher.pb

Declare.l Window_Main()

XIncludeFile "AvevaLauncher_Constants.pb"
XIncludeFile "AvevaLauncher_Windows.pb"


Procedure WindowCallback(WindowID,Message,wParam,lParam)
  ReturnValue=#PB_ProcessPureBasicEvents
  If Message=#WM_GETMINMAXINFO
    ReturnValue=PVDynamic_LockWindow(WindowID,lParam)
  EndIf
  If Message=#WM_SIZE
    ReturnValue=PVDynamic_Resize(WindowID)
  EndIf
 
  ProcedureReturn ReturnValue
   
EndProcedure


;- Main Loop
If Window_Main()

  SetWindowCallback(@WindowCallback())

  quitMain=0
  Repeat
    EventID  =WaitWindowEvent()
    MenuID   =EventMenu()
    GadgetID =EventGadget()
    WindowID =EventWindow()

    Select EventID
      Case #PB_Event_CloseWindow
        If WindowID=#Window_Main
          quitMain=1
        EndIf
    EndSelect
  Until quitMain
  CloseWindow(#Window_Main)
EndIf


Code:
; AvevaLauncher_Windows.pb

Procedure.l Window_Main()
  If OpenWindow(#Window_Main,184,98,390,660,"Aveva Launcher",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
      Frame3DGadget(#Gadget_Main_fApplications,5,5,240,60," Applications:  ")
      OptionGadget(#Gadget_Main_oApplication1,20,25,75,20,"PDMS")
      OptionGadget(#Gadget_Main_oApplication2,90,25,75,20,"Review")
      OptionGadget(#Gadget_Main_oApplication3,160,25,75,20,"Implant")
      Frame3DGadget(#Gadget_Main_fPDMSVOL,275,5,100,60," PDMSVOL ")
      TextGadget(#Gadget_Main_tsPDMSVOL,310,25,20,20,"J:",#PB_Text_Center)
      Frame3DGadget(#Gadget_Main_fServers,5,75,380,60," Licence Servers;  ")
      ComboBoxGadget(#Gadget_Main_lServers,15,95,220,20)
      ButtonGadget(#Gadget_Main_bCheck,255,95,60,20,"Check")
      TextGadget(#Gadget_Main_tsCheck,325,95,40,20,"0",#PB_Text_Center|#PB_Text_Border)
      Frame3DGadget(#Gadget_Main_fProjects,5,140,380,260,"Projects: ")
      ListIconGadget(#Gadget_Main_lProjects,15,160,360,230,"Number",60,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
        AddGadgetColumn(#Gadget_Main_lProjects,1,"Title",220)
        AddGadgetColumn(#Gadget_Main_lProjects,2,"Code",40)
        AddGadgetColumn(#Gadget_Main_lProjects,3,"Stat.",36)
      Frame3DGadget(#Gadget_Main_fAdminOptions,5,405,380,220,"Administrator Options: ")
      ListIconGadget(#Gadget_Main_lAdminOptions,15,425,360,190,"Module",120,#PB_ListIcon_CheckBoxes|#PB_ListIcon_MultiSelect|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
        AddGadgetColumn(#Gadget_Main_lAdminOptions,1,"MDB",116)
        AddGadgetColumn(#Gadget_Main_lAdminOptions,2,"PASSWORD",120)
      ButtonGadget(#Gadget_Main_bGo,5,635,60,20,"Go")
      ButtonGadget(#Gadget_Main_bRemoteSupport,120,635,120,20,"Remote Support")
      ButtonGadget(#Gadget_Main_bCancel,325,635,60,20,"Cancel")
      PVDynamic_AddLockWindow(#Window_Main,0,0,1)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fApplications,2)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fPDMSVOL,2)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fServers,2)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fProjects,1)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_lProjects,1)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fAdminOptions,1)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_lAdminOptions,1)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_bGo,4)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_bRemoteSupport,4)
      PVDynamic_AddGadget(#Window_Main,#Gadget_Main_bCancel,4)
      HideWindow(#Window_Main,0)
      ProcedureReturn WindowID(#Window_Main)
  EndIf
EndProcedure



Code:
; AvevaLauncher_Constants.pb

;- Global Variables and Constants
Global BubbleTipStyle.l:BubbleTipStyle=0

;- Window Constants
Enumeration 1
  #Window_Main
EndEnumeration
#WindowIndex=#PB_Compiler_EnumerationValue


;- Gadget Constants
Enumeration 1
  ;Window_Main
  #Gadget_Main_fApplications
  #Gadget_Main_oApplication1
  #Gadget_Main_oApplication2
  #Gadget_Main_oApplication3
  #Gadget_Main_fPDMSVOL
  #Gadget_Main_tsPDMSVOL
  #Gadget_Main_fServers
  #Gadget_Main_lServers
  #Gadget_Main_bCheck
  #Gadget_Main_tsCheck
  #Gadget_Main_fProjects
  #Gadget_Main_lProjects
  #Gadget_Main_fAdminOptions
  #Gadget_Main_lAdminOptions
  #Gadget_Main_bGo
  #Gadget_Main_bRemoteSupport
  #Gadget_Main_bCancel


EndEnumeration
#GadgetIndex=#PB_Compiler_EnumerationValue


Note as before
1. PB will compile and run ok
2. jaPBE will create .exe ok

So there is something that PB itself doesn't like.

Thanks

Neil


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Sat Mar 17, 2012 5:24 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2863
Location: Wales, UK
The code style looks odd to me in terms of being not what I'm used to seeing, couldn't see much wrong though, see 'thoughts' below.

I don't have the PVDynamic lib so had to comment those lines out. Moved SetWindowCallback(@WindowCallback()) into the Window_Main() Procedure, Declared the Procedures, replaced longs with integers, added End after the Main Loop, declared the BubbleTipStyle directly. Changed the names of vars where they clash with PB function names, e.g. GadgetID changed to iGadgetID.

It compiles to an exe in PB4.60 on WinXP 32bit.

Thoughts:
It could be that the version of PVDynamic lib you are using does not match the version of PB you are using. The PB trial version may not compile exes that use User libs. May be PB did not install 100% correctly, a re-install with a fresh download could be worth a try.

Code that compiled at first attempt:

Code:
;AvevaLauncher.pb

Declare WindowCallback(iWindowID,Message,wParam,lParam)
Declare Window_Main()

XIncludeFile "AvevaLauncher_Constants.pb"
XIncludeFile "AvevaLauncher_Windows.pb"


Procedure WindowCallback(iWindowID,Message,wParam,lParam)

  ReturnValue = #PB_ProcessPureBasicEvents

  If Message=#WM_GETMINMAXINFO

        ;ReturnValue = PVDynamic_LockWindow(iWindowID,lParam)

  EndIf

  If Message=#WM_SIZE

    ;ReturnValue = PVDynamic_Resize(iWindowID)

  EndIf
 
  ProcedureReturn ReturnValue
   
EndProcedure


;- Main Loop
If Window_Main()

       quitMain = 0
       
       Repeat
       
             iEventID  = WaitWindowEvent()
             iMenuID   = EventMenu()
             iGadgetID = EventGadget()
             iWindowID = EventWindow()
             
             Select iEventID
             
               Case #PB_Event_CloseWindow
             
                    If iWindowID = #Window_Main
                           quitMain = 1
                    EndIf
             
             EndSelect
       
       Until quitMain
       
       CloseWindow(#Window_Main)

EndIf

End


Code:
; AvevaLauncher_Constants.pb

;- Global Variables and Constants
Global BubbleTipStyle.i = 0

;- Window Constants
Enumeration 1
  #Window_Main
EndEnumeration

#WindowIndex = #PB_Compiler_EnumerationValue

;- Gadget Constants
Enumeration 1
  ;Window_Main
  #Gadget_Main_fApplications
  #Gadget_Main_oApplication1
  #Gadget_Main_oApplication2
  #Gadget_Main_oApplication3
  #Gadget_Main_fPDMSVOL
  #Gadget_Main_tsPDMSVOL
  #Gadget_Main_fServers
  #Gadget_Main_lServers
  #Gadget_Main_bCheck
  #Gadget_Main_tsCheck
  #Gadget_Main_fProjects
  #Gadget_Main_lProjects
  #Gadget_Main_fAdminOptions
  #Gadget_Main_lAdminOptions
  #Gadget_Main_bGo
  #Gadget_Main_bRemoteSupport
  #Gadget_Main_bCancel
EndEnumeration

#GadgetIndex = #PB_Compiler_EnumerationValue


Code:
; AvevaLauncher_Windows.pb

Procedure Window_Main()

  If OpenWindow(#Window_Main,184,98,390,660,"Aveva Launcher",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)

      Frame3DGadget(#Gadget_Main_fApplications,5,5,240,60," Applications:  ")
      OptionGadget(#Gadget_Main_oApplication1,20,25,75,20,"PDMS")
      OptionGadget(#Gadget_Main_oApplication2,90,25,75,20,"Review")
      OptionGadget(#Gadget_Main_oApplication3,160,25,75,20,"Implant")
      Frame3DGadget(#Gadget_Main_fPDMSVOL,275,5,100,60," PDMSVOL ")
      TextGadget(#Gadget_Main_tsPDMSVOL,310,25,20,20,"J:",#PB_Text_Center)
      Frame3DGadget(#Gadget_Main_fServers,5,75,380,60," Licence Servers;  ")
      ComboBoxGadget(#Gadget_Main_lServers,15,95,220,20)
      ButtonGadget(#Gadget_Main_bCheck,255,95,60,20,"Check")
      TextGadget(#Gadget_Main_tsCheck,325,95,40,20,"0",#PB_Text_Center|#PB_Text_Border)
      Frame3DGadget(#Gadget_Main_fProjects,5,140,380,260,"Projects: ")
      ListIconGadget(#Gadget_Main_lProjects,15,160,360,230,"Number",60,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
        AddGadgetColumn(#Gadget_Main_lProjects,1,"Title",220)
        AddGadgetColumn(#Gadget_Main_lProjects,2,"Code",40)
        AddGadgetColumn(#Gadget_Main_lProjects,3,"Stat.",36)
      Frame3DGadget(#Gadget_Main_fAdminOptions,5,405,380,220,"Administrator Options: ")
      ListIconGadget(#Gadget_Main_lAdminOptions,15,425,360,190,"Module",120,#PB_ListIcon_CheckBoxes|#PB_ListIcon_MultiSelect|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
        AddGadgetColumn(#Gadget_Main_lAdminOptions,1,"MDB",116)
        AddGadgetColumn(#Gadget_Main_lAdminOptions,2,"PASSWORD",120)
      ButtonGadget(#Gadget_Main_bGo,5,635,60,20,"Go")
      ButtonGadget(#Gadget_Main_bRemoteSupport,120,635,120,20,"Remote Support")
      ButtonGadget(#Gadget_Main_bCancel,325,635,60,20,"Cancel")

;       PVDynamic_AddLockWindow(#Window_Main,0,0,1)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fApplications,2)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fPDMSVOL,2)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fServers,2)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fProjects,1)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_lProjects,1)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_fAdminOptions,1)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_lAdminOptions,1)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_bGo,4)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_bRemoteSupport,4)
;       PVDynamic_AddGadget(#Window_Main,#Gadget_Main_bCancel,4)

      HideWindow(#Window_Main,0)

      SetWindowCallback(@WindowCallback())

      ProcedureReturn WindowID(#Window_Main)

  EndIf

EndProcedure

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Mon Mar 19, 2012 4:27 am 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
Hi IdeasVacuum,

Thanks for spending time on this one.

I've given up - I can't even get your files to run !!

I've loaded 4.60 to see if that helped - no luck.

It's not worth spending anymore time on - I'll just use jaPBe to create exe.

I swap between jaPBE and PB IDE anyway.

Thanks again,

Neil


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Mon Mar 19, 2012 4:50 am 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 1386
Location: Boston, MA
Hi Neil,
It is not a good sign if you cannot compile your code in the PB IDE. :?
Forget about all the files and stuff and paste everything in 1 file for now.

Use EnableExplicit
Turn Off Project Mode
Go to compiler options and verify nothing is checked.
Then Compile with Unicode ON and OFF.
Compile with and without Debugger(use MessageRequester() to signal success or fail).

After you have a working code, then try breaking up into definable IncludeFiles.
When you do create an IncludeFile, try to force it to compile by itself.
You may need to rearrange some Procedures or use Declares(I probably use 2).
You may need to have an Include that feeds another(XincludeFile at top).
But that will come about naturally as you expand your code base.

_________________
To understand recursion, you must first understand recursion. ~ unknown
I never make stupid mistakes. Only very, very clever ones. ~ John Peel


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Mon Mar 19, 2012 5:06 am 
Offline
User
User

Joined: Wed Feb 29, 2012 8:04 am
Posts: 67
Location: Melbourne, AUS
Hi Skywalk

Thanks for reply and suggetions - I'll give them a go.

But as I said in earlier posts - PB will compile and run the app ok, it just won't create the executable.

Maybe something to do with the PureVision add-on, but as I want to keep using this, it's not much point trying to fiind a solution to my problem if it means I have to modify the files PV creates.

I can just continue as is - i.e. do all development/testing in PB/jaPBe and then create the final .exe in jaPBe.

Thanks,

Neil


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Mon Mar 19, 2012 5:09 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2863
Location: Wales, UK
Hi Neil

If PB will not compile my simplified version of your code, then I think there either has to be something very wrong with the install, or there is something upsetting a PB process (Anti-Virus?). Certainly worth uninstalling/reinstalling PB, make sure the uninstall is squeaky-clean. I use Revo Uninstaller Free: http://www.revouninstaller.com/revo_uninstaller_free_download.html.

I can't think of any reason why jaPBe would be able to compile the simplified source and produce a good exe yet PB could not, that shouldn't happen.

Edit: failing to create the exe is not a PureVision fault, given that the PV stuff is commented out.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PB IDE will compile program but won't create executable
PostPosted: Mon Mar 19, 2012 5:16 am 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 1386
Location: Boston, MA
Ok. I don't use a VD so I am lost there. But, it sounds like a smaller problem to fix if you can compile successfully. I think there are more than a few users of PureVision. Maybe uninstall/reinstalling that would help?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Exabot [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye