Page 1 of 1

IDE works - Compiler doesn't

Posted: Sun Oct 26, 2025 6:51 am
by RogerTunnicliffe
If compile my code in the IDE it works fine but if i use pbcompiler I get the following message:-

Error: Assembler
purebasic.asm [119]:
extrn SetCurrentDirectoryA
processed: extrn SetCurrentDirectoryA
error: symbol already defined.
..
that's a windows call (SetCurrentDirectoryA)
..

is there some sort of switch I am missing on the compiler ??

[EDIT] I just noticed. If I run the compiler with the -c option (produce a commented asm output [purebasic.asm]) then I also get a PureBasic.exe that seems to run fine ???

Cheers
Roger

Re: IDE works - Compiler doesn't

Posted: Sun Oct 26, 2025 2:45 pm
by mk-soft
The right environment must be set.
See in the installation of PB "PureBasic-CLI.cmd"
Or start it.

Code: Select all

;-TOP Run from PB-IDE. Not das Compiled Program
; Set enviroment automatik
RunProgram("cmd", "/K SET", "")

Re: IDE works - Compiler doesn't

Posted: Mon Oct 27, 2025 6:07 am
by RogerTunnicliffe
"PureBasic-CLI.cmd" This is not in my install directories of PureBasic

RunProgram("cmd", "/K SET", "") and sorry I don't know what this means. Is this to be coded in the program, because when i do it does nothing.
I just get

Error: Line 1 - Syntax error

??

Re: IDE works - Compiler doesn't

Posted: Mon Oct 27, 2025 4:17 pm
by Axolotl
The question is, which options (compiler flags) do you use?
I would recommend at least: (call compiler with /? to see all flags)

Code: Select all

/OUTPUT     -o   --output   "Filename"  ; Create an executable or a dll to the given filename
The batch file “PureBasic-CLI.cmd” should be located in the PureBasic installation directory. (Where the Purebasic.exe file is also located.)
This is the content. (I have never used it.)

Code: Select all

@echo off
SET PUREBASIC_HOME=%cd%
SET PATH=%PUREBASIC_HOME%/compilers;%PATH%
cmd