IDE works - Compiler doesn't

Just starting out? Need help? Post your questions and find answers here.
RogerTunnicliffe
User
User
Posts: 24
Joined: Fri Oct 17, 2025 10:10 pm

IDE works - Compiler doesn't

Post 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
User avatar
mk-soft
Always Here
Always Here
Posts: 6479
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: IDE works - Compiler doesn't

Post 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", "")
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
RogerTunnicliffe
User
User
Posts: 24
Joined: Fri Oct 17, 2025 10:10 pm

Re: IDE works - Compiler doesn't

Post 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

??
Axolotl
Addict
Addict
Posts: 907
Joined: Wed Dec 31, 2008 3:36 pm

Re: IDE works - Compiler doesn't

Post 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
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply