Command line compiler syntax to create executable?
Command line compiler syntax to create executable?
Hi,
My OS is Linux and I'm using the Linux IDE but would like to create a windows executable from the Wine emulator on the command line (using the source code written in the Linux IDE), but I keep getting errors when trying to use pbcompiler.exe to create an executable, either "no such switch" or "file not found". Could someone give me an example of the correct syntax? There isn't a specific example of this in the manual. Do I need to include quotes in the filename/path?
Sorry for the noob question, and thanks in advance for any help.
My OS is Linux and I'm using the Linux IDE but would like to create a windows executable from the Wine emulator on the command line (using the source code written in the Linux IDE), but I keep getting errors when trying to use pbcompiler.exe to create an executable, either "no such switch" or "file not found". Could someone give me an example of the correct syntax? There isn't a specific example of this in the manual. Do I need to include quotes in the filename/path?
Sorry for the noob question, and thanks in advance for any help.
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Command line compiler syntax to create executable?
Not sure of Linux. No quotes needed.
BERESHEIT
Re: Command line compiler syntax to create executable?
Hi netmaestro, thanks but I've already looked at the help and I'm still getting an error message "A filename needs to be specified".
Here's the output when I try to create an executable from a file "first.pb" in the folder "/home/jules/purebasic/code/".
Here's the output when I try to create an executable from a file "first.pb" in the folder "/home/jules/purebasic/code/".
Code: Select all
Z:\home\jules\.wine\drive_c\Program Files\PureBasic\Compilers>pbcompiler /EXE /home/jules/purebasic/code/first.pb
PureBasic 5.44 LTS (Windows - x86) - (c) 2016 Fantaisie Software
A filename need to be specified.
Type 'pbcompiler /?' for quick help.
Re: Command line compiler syntax to create executable?
You must provide the EXE filename you want to be created after /EXE (because it can be different of source file)
/EXE "Filename": Create an executable to the given filename
Do not forget to add extension .exe (compiler does not add it by default)
Note: without /EXE and filename, PB create an exe called PureBasic.exe in folder of pbcompiler (dangerous!)
IDE create PureBasic_Compilation0.exe (and 1, 2, 3 etc)
You are right, the message is not explicite, IMHO it must be
An output filename need to be specified.
/EXE "Filename": Create an executable to the given filename
Code: Select all
Z:\home\jules\.wine\drive_c\Program Files\PureBasic\Compilers>pbcompiler /EXE "/home/jules/purebasic/code/first.exe" /home/jules/purebasic/code/first.pb
Note: without /EXE and filename, PB create an exe called PureBasic.exe in folder of pbcompiler (dangerous!)
IDE create PureBasic_Compilation0.exe (and 1, 2, 3 etc)
You are right, the message is not explicite, IMHO it must be
An output filename need to be specified.
Re: Command line compiler syntax to create executable?
Thanks Marc56us, but running that command I get "unknown switch":
Maybe it's easier if I just create the exe from the Windows IDE under Wine.
Code: Select all
wine pbcompiler /EXE "/home/jules/purebasic/code/first.exe" /home/jules/purebasic/code/first.pb
/HOME/JULES/PUREBASIC/CODE/FIRST.PB: Unknown switch
Re: Command line compiler syntax to create executable?
Code: Select all
wine pbcompiler /EXE "/home/jules/purebasic/code/first.exe" /home/jules/purebasic/code/first.pb
/HOME/JULES/PUREBASIC/CODE/FIRST.PB: Unknown switch
Code: Select all
wine pbcompiler /EXE "/home/jules/purebasic/code/first.exe" "\home\jules\purebasic\code\first.pb"
Code: Select all
root@debian:~/Wine_PureBasic/PureBasicLTS/Compilers# wine pbcompiler /exe "/root/Documents/hello.exe" "\root\Documents\hello.pb"
******************************************
PureBasic 5.44 LTS (Windows - x86)
******************************************
Compiling \root\Documents\hello.pb
Loading external libraries...
Starting compilation...
3 lines processed.
Creating executable "/root/Documents/hello.exe".
- Feel the ..PuRe.. Power -
root@debian:~/Wine_PureBasic/PureBasicLTS/Compilers# ls -l hello*
-rwxr-xr-x 1 root root 3072 mai 24 13:52 hello.exe
-rw-r--r-- 1 root root 31 mai 24 13:51 hello.pb
root@debian:~/Wine_PureBasic/PureBasicLTS/Compilers#
The last time I used Wine it was in 1999 (!) I just reinstall it today (18 years later...) just to solve your problem
Re: Command line compiler syntax to create executable?
I really appreciate your help, but sadly still no luck. Did you mean for the second path to be using forward slashes instead of backslashes? Anyway, I tried both ways and here are the results (note that I changed the file to "Gadget.pb" taken from the examples folder):Marc56us wrote:The last time I used Wine it was in 1999 (!) I just reinstall it today (18 years later...) just to solve your problem
With forward slashes
Code: Select all
wine pbcompiler /EXE "/home/jules/purebasic/code/first.exe" "\home\jules\purebasic\code\Gadget.pb"
******************************************
PureBasic 5.44 LTS (Windows - x86)
******************************************
Compiling \home\jules\purebasic\code\Gadget.pb
Loading external libraries...
Error: File not found (\home\jules\purebasic\code\Gadget.pb).
Code: Select all
wine pbcompiler /EXE "/home/jules/purebasic/code/first.exe" "/home/jules/purebasic/code/Gadget.pb"
/HOME/JULES/PUREBASIC/CODE/GADGET.PB: Unknown switch
Re: Command line compiler syntax to create executable?
Source file exist ?
What result of:
Reply must be:
Code: Select all
Error: File not found (\home\jules\purebasic\code\Gadget.pb)
Code: Select all
file /home/jules/purebasic/code/Gadget.pb
Code: Select all
/home/jules/purebasic/code/Gadget.pb : ASCII text
Re: Command line compiler syntax to create executable?
Aha!
So I guess the problem is it's not recognized as a Windows file. I need to convert it, or use Gadget.pb from the Windows installation.
I'll do that and try again.
Code: Select all
/home/jules/purebasic/code/Gadget.pb: ISO-8859 text, with CRLF line terminators
I'll do that and try again.
Re: Command line compiler syntax to create executable?
Strange, I converted the file using unix2dos but the file command still returns
Code: Select all
/home/jules/purebasic/code/Gadget.pb: ISO-8859 text, with CRLF line terminators
Re: Command line compiler syntax to create executable?
all works for me
(Test now with PB sample Gadget.pb)
(previous file created with (horrible) 'vi' just a ligne MessageRequester("", "Hello"))
(removed long prompt)
Then transfered on Windows for test = OK
(Test now with PB sample Gadget.pb)
(previous file created with (horrible) 'vi' just a ligne MessageRequester("", "Hello"))
(removed long prompt)
Code: Select all
# file ../Examples/Sources/Gadget.pb
../Examples/Sources/Gadget.pb: ISO-8859 text, with CRLF line terminators
# wine pbcompiler.exe /EXE "Gadget.exe" ../Examples/Sources/Gadget.pb
******************************************
PureBasic 5.44 LTS (Windows - x86)
******************************************
Compiling ../Examples/Sources/Gadget.pb
Loading external libraries...
Starting compilation...
125 lines processed.
Creating executable "Gadget.exe".
# ls -l Ga*
-rwxr-xr-x 1 root root 55296 mai 24 15:30 Gadget.exe
# file Gadget.exe
Gadget.exe: PE32 executable (GUI) Intel 80386, for MS Windows
Re: Command line compiler syntax to create executable?
Ok it finally works, but only when I put the source file in the compilers folder. So I guess the problem was to do with path/environment variables. I'll have to find out how to add these in Wine. Thanks a lot for your help.