Compiler error.

Just starting out? Need help? Post your questions and find answers here.
User avatar
bfernhout
Enthusiast
Enthusiast
Posts: 125
Joined: Mon Feb 26, 2018 10:41 pm
Location: Netherlands
Contact:

Compiler error.

Post by bfernhout »

I got a problem to compile a sourtce code from a book. When is run it trough the butten menu including debugger its compiling on the right way. Do it excluding Debugger. This is ok to. But when i go to the menu selecting compiler and then select create executable. I got a error on a call to a procedure that is included in another file. But it is in the mainfile declared. And the included file is in the right folder. The compiler points to the wrong line, Give the wrong file number. And say that the name is not a function,list,array, or macro.
I am not able to insert a image here. So i give the example code that i use

Code: Select all

; Initialize the sprite and keyboard systems and a 640x480, 32-bit screen
If InitSprite() = 0 Or InitKeyboard() = 0 Or OpenScreen(640,480,32,"App Title") = 0
   MessageRequester("Error!", "Unable to Initialize Environment", #PB_MessageRequester_Ok)
   End
EndIf

Declare Waitkey()     ;<----- Here is the decleration

; include our generic library
XIncludeFile "../libraries/generic.pb"  ;<---- here is the include
; create the file
FilePtr = CreateFile(#PB_Any,"filetest.txt")

If FilePtr = 0
   MessageRequester("Error!", "Unable to Create File", #PB_MessageRequester_Ok)
   End
EndIf 

; write our strings out to the file
WriteStringN(FilePtr,"Hello, PureBasic!")     ;<--- Compiler point to this line and say that  waitkey() is an error
WriteStringN(FilePtr,"Testing...testing...1...2...3....4!")

; close the file
CloseFile(FilePtr)

; put up a little message to the user that we're done
If StartDrawing(ScreenOutput()) 
  DrawText(0,0,"File created and written to.  Press any key to exit")
Else
   MessageRequester("Error!", "Unable to Draw to ScreenOutput()", #PB_MessageRequester_Ok)
   End
EndIf

StopDrawing()

; show the output to the users
FlipBuffers()

; wait for a keypress
WaitKey()    ;<-- here is the line

; end the program
End
If the compile and run is saying this is a error then its oke for me. But only the make exe is giving the error.
What is wrong here.

Bart Fernhout.
From my first self made computer till now I stil like computers.
User avatar
bfernhout
Enthusiast
Enthusiast
Posts: 125
Joined: Mon Feb 26, 2018 10:41 pm
Location: Netherlands
Contact:

Re: Compiler error.

Post by bfernhout »

Found solution of this error.

First of all. I have a computer on my work and install the latest versionof PB X68. Try out the source code and it compiled and make a exe. Secondly install beside the X68 version the X64 version. Both installed with full path and menu linking. Run the 64 editor and the same error occure. Remove the X64 version and the error stay's. remove the X68 version. Scan the computer and remove all residue of PB. Install again the x64 version. Load code and make exe. No problem. Install X68 version including full path etc. The same error came back again.

Did go back to the start and install the X64 version and then the X68 version but no full path no linking and no file connection. Starting the IDE and load the code. Compiling went ok. In prefference set the compiling from x64 to x68. Requested the make exe again. And program is working. Make two files a x64 and X68 borh are working on differend computers. File size of X64 is 150 kb bigger.

While writting this text i just tested the things i done on my work. Removed all kind of PB stuff excluding the source files from the computer. Restart computer Reinstall PB X64 and then PB X68 only the folders and no connection or so. Started the ide, load the source code. Try to make the EXE. And yes it works. I can make now a 32 or 64 bits version.

So for the people who had the same problem, I think this is the solution to make it work.
From my first self made computer till now I stil like computers.
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Compiler error.

Post by Bitblazer »

What a journey ;) welcome to the PB forum and congrats, good to see you could solve the mystery instead of just giving up and moving on :)
User avatar
bfernhout
Enthusiast
Enthusiast
Posts: 125
Joined: Mon Feb 26, 2018 10:41 pm
Location: Netherlands
Contact:

Re: Compiler error.

Post by bfernhout »

Thanks.
I am not that kind of a quitter. When i want to start something i need it to finished it.
I this case i had a couple of computers to try on. And the computer where the error start is my personal one. And on that one i am alway carefull what to do on it. And that can cause sometimes problems. But on the other computer they are Company computers so if something is going wrong on one of that one. The IT man is solving it.
Easy problem solved.
From my first self made computer till now I stil like computers.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Compiler error.

Post by blueznl »

Hey, nog een Nederlander :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply