I am a newby with Purebasic and have the following problem:
When I compile an example script 'database.pb' in de map "sources" I cannot open the resulting exe.
Maybe some commands must be added to 'database.pb'?
I found that the "debug" statement are ignored when creating an executable.
The script runs fine when I compile/run. How can I compile to a working .exe?
compile problem
Re: compile problem
Welcome 
The example uses SQLite. The lib static is linked to the executable.
For MySQL, supply the libmariadb.[dll,so, dylib] with the executable. To do this, copy the libmariadb.dll file from the purebasic under the compilers folder and add it to the folder of your executable.
All lines containing debug are not compiled to the executable. Therefore it does not work.
The example uses SQLite. The lib static is linked to the executable.
For MySQL, supply the libmariadb.[dll,so, dylib] with the executable. To do this, copy the libmariadb.dll file from the purebasic under the compilers folder and add it to the folder of your executable.
All lines containing debug are not compiled to the executable. Therefore it does not work.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: compile problem
Welcome. This should do what you want, I've sent the debug window output to a console window instead. You'll need to set the "Executable Format" to "Console" in the "Compiler Options" dialog before you compile.
Code: Select all
UseSQLiteDatabase()
Procedure CheckDatabaseUpdate(Database, Query$)
Result = DatabaseUpdate(Database, Query$)
If Result = 0
PrintN(DatabaseError())
EndIf
ProcedureReturn Result
EndProcedure
OpenConsole("Database Example")
DatabaseFile$ = GetTemporaryDirectory()+"Database.sqlite"
If CreateFile(0, DatabaseFile$)
CloseFile(0)
If OpenDatabase(0, DatabaseFile$, "", "")
CheckDatabaseUpdate(0, "CREATE TABLE food (name CHAR(50), weight INT)")
CheckDatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('apple', '10')")
CheckDatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('pear', '5')")
CheckDatabaseUpdate(0, "INSERT INTO food (name, weight) VALUES ('banana', '20')")
PrintN("SELECT * FROM food WHERE weight > 7")
If DatabaseQuery(0, "SELECT * FROM food WHERE weight > 7")
While NextDatabaseRow(0)
PrintN(GetDatabaseString(0, 0))
Wend
FinishDatabaseQuery(0)
EndIf
CloseDatabase(0)
Else
PrintN("Can't open database !")
EndIf
Else
PrintN("Can't create the database file !")
EndIf
PrintN("Press Enter to end...")
Input()Re: compile problem
Hi Spikey,
Many thanks for your help !
Things work fine now.
Gratefully,
Rob
Many thanks for your help !
Things work fine now.
Gratefully,
Rob


