PB v6.0 Beta 1 C output?

Just starting out? Need help? Post your questions and find answers here.
Robeene
User
User
Posts: 15
Joined: Sun Aug 15, 2021 6:34 am

PB v6.0 Beta 1 C output?

Post by Robeene »

I've been trying to find how to output C code from v6.00 and I can't find it for the life of me.
I've seen others metioning it but not saying how.
Please advise thanks
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: PB v6.0 Beta 1 C output?

Post by juergenkulow »

pbcompilerc outputs: "No authorization".

Code: Select all

kulow@kulow-VGN-AR51SU:/tmp/purebasicBeta1/compilers$ dir
debugger.a	       pbdebugger		 stringmanagercthreadpurifier.a
dynamicconstructor.o   pbdocmaker		 stringmanagerpurifier.a
engine3d.so	       pblibrarymaker		 stringmanagerthread.a
fasm		       pbsoimporter		 stringmanagerthreadpurifier.a
libmariadb.so	       purebasic		 stringutility.a
objectmanager.a        stringmanager.a		 systembase.a
objectmanagerthread.a  stringmanagerc.a		 unicodefunctions.a
pbcompiler	       stringmanagercpurifier.a
pbcompilerc	       stringmanagercthread.a
kulow@kulow-VGN-AR51SU:/tmp/purebasicBeta1/compilers$ /tmp/purebasicBeta1/compilers/pbcompiler --help
USAGE: pbcompiler <sourcefile>

OPTIONS:
  -c, --commented         Produce commented asm output (purebasic.asm)
  -d, --debugger          Enable debugger
  -t, --thread            Enable threadsafe support
  -e, --executable <file> Create executable to <file>
  -i, --import <file>     Create import file to <file>
  -r, --resident <file>   Create resident file to <file>
  -ir, --ignoreresident <file>
                          Ignore the given resident <file>
  -q, --quiet             Display only error on the standard output
  -sb, --standby          Starts compiler in standby mode (remote control)
  -pf, --purifier         Enable purifier
  -ls, --liststructures   Creates a file with all the structures
  -lf, --listfunctions    Creates a file with all the functions
  -li, --listinterfaces   Creates a file with all the interfaces
  -lp, --listpath         Set the output path for the above lists commands
  -qs, --querystructure <name>
                          Creates a file with the definition
  -s, --subsystem <name>  Uses the specified subsystem
  -so, --sharedobject <file>
                          Create a dynamic library (shared object)
  -dc, --dynamiccpu       Create a executable with all processor specific routines
  -mmx, -3dnow, -sse, -sse2
                          Create a processor specific executable
  -l, --linenumbering     Enable line numbering support for OnError
  -o, --constant Name=Value
                          Declare a new constant at compile time
  -g, --language          Set the language of the compiler error messages
  -ds, --debugsymbols     Add standard debug symbols to executable
  -k, --check             Check the syntax only, doesn't create/launch the executable
  -pp, --preprocess <file>
                          Creates a single file with all macros expanded and all sources files included
  -v, --version           Display the compiler version

kulow@kulow-VGN-AR51SU:/tmp/purebasicBeta1/compilers$ /tmp/purebasicBeta1/compilers/pbcompilerc --help
bash: /tmp/purebasicBeta1/compilers/pbcompilerc: Keine Berechtigung
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: PB v6.0 Beta 1 C output?

Post by Marc56us »

kulow@kulow-VGN-AR51SU:/tmp/purebasicBeta1/compilers$ /tmp/purebasicBeta1/compilers/pbcompilerc --help
bash: /tmp/purebasicBeta1/compilers/pbcompilerc: Keine Berechtigung

pbcompilerc: Keine Berechtigung (= Permission denied)
Compilerc must be set as executable (+x) for user(s) :wink:

Code: Select all

$ ./pbcompilerc
-bash: ./pbcompilerc: Permission denied
$ chmod +x pbcompilerc
$ ./pbcompilerc
PureBasic 6.00 Beta 1 - C Backend (Linux - x64) - (c) 2021 Fantaisie Software
:!: Compiling with command line compiler :arrow: don't forget to set PUREBASIC_HOME even if compile from pb directory. So set it to where your pb install root

Code: Select all

$ export PUREBASIC_HOME=~/Documents/purebasic/
(Yes, I shouldn't have installed it there, but I'm testing several configurations)
I've been trying to find how to output C code from v6.00 and I can't find it for the life of me.
To produce C output: -c (pbcompilerc <source> -c)

Code: Select all

$ ./pbcompilerc HelloWorld.pb -c
PureBasic 6.00 Beta 1 - C Backend (Linux - x64)
Loading external modules...
Loading 'c' subsystem
Starting compilation...
Starting compilation...
6 lines processed.
Creating the executable.

- Feel the ..PuRe.. Power -

Hello 1st PureBasic program on Raspberry pi!
$ 
C source is named purebasic.c whatever source name and purebasic.out the executable
($ ls -rtl to see last file in dir)

Code: Select all

$ cat purebasic.c
// 
// PureBasic 6.00 Beta 1 - C Backend (Linux - x64) generated code
// 
// (c) 2021 Fantaisie Software
// 
// The header must remain intact for Re-Assembly
// 
// Console
// :System
// 
#pragma warning(disable: 4024)
// 
typedef long long quad;
typedef quad integer;
#define PB_INFINITY (1.0 / 0.0)
...
My little test file

Code: Select all

$ cat HelloWorld.pb
OpenConsole()
PrintN("Hello 1st PureBasic program on Raspberry pi!")
Input()
CloseConsole()
End
Also tested on Microsoft WSL 1 with Debian
Enjoy :wink:
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.0 Beta 1 C output?

Post by mk-soft »

As PB-Tools
Base of Sicro. German-Forum: https://www.purebasic.fr/german/viewtop ... 10&t=30935
Modified for C-Code

Update v1.02.2
- Added default constants: -o PB_Editor_BuildCount=0 -o PB_Editor_CompileCount=0

displayC.pb

Code: Select all

;-Description   : Displays the commented C code from the PB compiler
; OS            : Windows, Linux, Mac
; English-Forum :
; French-Forum  :
; German-Forum  : https://www.purebasic.fr/german/viewtopic.php?f=10&t=30935
; 
; Author        : Sicro
; Author second : mk-soft (Modified for C-Code)
; Update        : 28.11.2021

; -----------------------------------------------------------------------------

; MIT License
;
; Copyright (c) 2018-2020 Sicro
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in all
; copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
; SOFTWARE.

; Tool Settings:
; - Arguments: "%FILE" "%TEMPFILE"
; - Event:     Menu Or Shortcut
; For MacOS, the field "Commandline" must contain the full path to the executable
; file, e.g.: .../Program.app/Contents/MacOS/Program

EnableExplicit

; =============
;-Include Codes
; =============

;XIncludeFile "../System/OpenStandardProgram.pbi"

Procedure.i OpenWithStandardProgram(FilePath$)
  
  Protected Result
  
  ; Avoid problems with paths containing spaces
  FilePath$ = #DQUOTE$ + FilePath$ + #DQUOTE$
  
  CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_Windows
      ; https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-shellexecutew
      Result = Bool(ShellExecute_(0, "open", FilePath$, #Null, #Null, #SW_SHOW) > 32)
    CompilerCase #PB_OS_Linux
      ; https://portland.freedesktop.org/doc/xdg-open.html
      Result = Bool(RunProgram("xdg-open", FilePath$, GetCurrentDirectory()))
    CompilerCase #PB_OS_MacOS
      Result = Bool(RunProgram("open", FilePath$, GetCurrentDirectory()))
  CompilerEndSelect
  
  ProcedureReturn Result
  
EndProcedure

; ================
;-Define Constants
; ================

CompilerIf Not Defined(PB_Processor_Arm32, #PB_Constant)
  #PB_Processor_Arm32 = 7
CompilerEndIf

CompilerIf Not Defined(PB_Processor_Arm64, #PB_Constant)
  #PB_Processor_Arm64 = 6
CompilerEndIf

#Program_Name     = "Display C-Code"
#ErrorWindowTitle = #Program_Name + " - ERROR"

#Window_Main = 0

Enumeration Gadget
  #Editor_Output
  #Button_OpenStandardEditor
  #Button_CopyToClipboard
EndEnumeration

; ======================
;-Define Local Variables
; ======================

Define compilerHomePath$, compilerFilePath$, workingDirectoryPath$, codeFilePath$, codeTempFilePath$,
       cCodeFilePath$, exeFilePath$, outputFilePathForStandardProgram$, compilerParameters$,
       compilerUserParameters$
Define cCode$, output$, compilerOutput$
Define program, file, event, isCompilerError, countOfParameters, i, isLibrary

Define compilerVersion$, isCompilerV6

; ==============================
;-Set Values For Local Variables
; ==============================

outputFilePathForStandardProgram$ = GetTemporaryDirectory() + RemoveString(#Program_Name, " ") + "-Output.txt"

compilerFilePath$ = GetEnvironmentVariable("PB_TOOL_Compiler")
If compilerFilePath$ = ""
  MessageRequester("Info", "Run only as PB-IDE Tool", #PB_MessageRequester_Info)
  End
EndIf

CompilerSelect #PB_Compiler_Processor
  CompilerCase #PB_Processor_Arm32
    ;
  CompilerCase #PB_Processor_Arm64
    ;
  CompilerDefault
    If Not FindString(compilerFilePath$, "pbcompilerc")
      compilerFilePath$   = ReplaceString(compilerFilePath$, "pbcompiler", "pbcompilerc")
    EndIf
CompilerEndSelect

; Run the PB compiler to get compiler version
program = RunProgram(compilerFilePath$, "-v", "", #PB_Program_Open | #PB_Program_Read)

; Read the PB compiler output compiler version
If program
  While ProgramRunning(program)
    While AvailableProgramOutput(program)
      compilerVersion$ + ReadProgramString(program) + #CRLF$
    Wend
  Wend
  isCompilerError = Bool(ProgramExitCode(program))
  CloseProgram(program)
Else
  isCompilerError = #True
EndIf

If FindString(compilerVersion$, "PureBasic 6.")
  isCompilerV6 = #True
EndIf

compilerHomePath$ = GetPathPart(compilerFilePath$)
codeFilePath$     = ProgramParameter(0) ; "%FILE"
codeTempFilePath$ = ProgramParameter(1) ; "%TEMPFILE"

If codeFilePath$ = ""
  ; The code has not yet been saved
  ; Use the path of the auto-generated temp code file
  codeFilePath$ = codeTempFilePath$
EndIf

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  cCodeFilePath$ = compilerHomePath$ + "purebasic.c"
CompilerElse
  cCodeFilePath$ = GetPathPart(codeFilePath$) + "purebasic.c"
CompilerEndIf

; The EXE file is only created so that the PB compiler does not execute the code, but only creates the ASM code
exeFilePath$ = GetTemporaryDirectory() + "purebasic"

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  workingDirectoryPath$ = GetPathPart(compilerFilePath$)
CompilerElse
  workingDirectoryPath$ = GetPathPart(codeFilePath$)
CompilerEndIf

compilerParameters$ = "--commented"

; Parameter for constants change since pb v6.00
If isCompilerV6
  compilerParameters$ + " -co PB_Editor_BuildCount=0 -co PB_Editor_CompileCount=0"
Else
  compilerParameters$ + " -o PB_Editor_BuildCount=0 -o PB_Editor_CompileCount=0"
EndIf

If Val(GetEnvironmentVariable("PB_TOOL_Thread"))
  compilerParameters$ + " --thread"
EndIf

If Val(GetEnvironmentVariable("PB_TOOL_Unicode"))
  compilerParameters$ + " --unicode"
EndIf

If GetEnvironmentVariable("PB_TOOL_SubSystem")
  compilerParameters$ + " --subsystem " + GetEnvironmentVariable("PB_TOOL_SubSystem")
EndIf

Procedure$ ProcessParameter(parameter$, exeFilePath$, *isLibrary.Integer)
  Select LCase(parameter$)
    Case "-dl", "--dylib", "-so", "--sharedobject"
      parameter$ = parameter$ + " " + #DQUOTE$ + exeFilePath$ + #DQUOTE$
      *isLibrary\i = #True
    Case "/dll"
      parameter$ = "--executable " + #DQUOTE$ + exeFilePath$ + #DQUOTE$ + parameter$
      *isLibrary\i = #True
  EndSelect
  ProcedureReturn parameter$
EndProcedure

; Get user parameters
countOfParameters = CountProgramParameters()
For i = 2 To countOfParameters - 1
  compilerUserParameters$ + " " + ProcessParameter(ProgramParameter(i), exeFilePath$, @isLibrary)
Next
If Not isLibrary
  compilerParameters$ + " --executable " + #DQUOTE$ + exeFilePath$ + #DQUOTE$
EndIf
compilerParameters$ + compilerUserParameters$

; =======================
;-Delete Old Output Files
; =======================

; Make sure that there are no previous output files, to prevent old output files from being read, if an error occurs.
DeleteFile(cCodeFilePath$)
DeleteFile(exeFilePath$)

; ====================
;-Create ASM Code File
; ====================

; Run the PB compiler to create the ASM code file
program = RunProgram(compilerFilePath$,
                     #DQUOTE$ + codeFilePath$ + #DQUOTE$ + " " + compilerParameters$,
                     workingDirectoryPath$,
                     #PB_Program_Open | #PB_Program_Read)

; Read the PB compiler output
If program
  While ProgramRunning(program)
    While AvailableProgramOutput(program)
      compilerOutput$ + ReadProgramString(program) + #CRLF$
    Wend
  Wend
  isCompilerError = Bool(ProgramExitCode(program))
  CloseProgram(program)
Else
  isCompilerError = #True
EndIf

; Read the ASM code file
file = ReadFile(#PB_Any, cCodeFilePath$)
If file
  cCode$ + ReadString(file, #PB_File_IgnoreEOL)
  CloseFile(file)
EndIf

; If an error has occurred, output detailed information
If isCompilerError Or cCode$ = ""
  MessageRequester(#ErrorWindowTitle, "Tool could not create the asm output!" +
                                      #CRLF$ + #CRLF$ +
                                      "Note that the PB compiler only generates ASM output if the PB code is syntaxically correct!" +
                                      #CRLF$ + #CRLF$ +
                                      "-------------------------------------" +
                                      #CRLF$ + #CRLF$ +
                                      "Compiler File Path:"        + #CRLF$ + compilerFilePath$     + #CRLF$ + #CRLF$ +
                                      "Compiler Parameters:"       + #CRLF$ + compilerParameters$   + #CRLF$ + #CRLF$ +
                                      "Compiler Working Dir Path:" + #CRLF$ + workingDirectoryPath$ + #CRLF$ + #CRLF$ +
                                      "C-Code File Path:"          + #CRLF$ + cCodeFilePath$        +
                                      #CRLF$ + #CRLF$ +
                                      "-------------------------------------" +
                                      #CRLF$ + #CRLF$ +
                                      "Compiler Output:"           + #CRLF$ + compilerOutput$,
                   #PB_MessageRequester_Error)
  End
EndIf

; Remove the ASM file only if no error occurred to avoid removing error traces
DeleteFile(exeFilePath$)

output$ = "##############################################" + #CRLF$ +
          "Compiler File Path: "  + compilerFilePath$      + #CRLF$ +
          "Compiler Parameters: " + compilerParameters$    + #CRLF$ +
          "C-Code File Path:"     + cCodeFilePath$         + #CRLF$ +
          #CRLF$ +
          "##############################################" + #CRLF$ +
          compilerOutput$ + #CRLF$ +
          "##############################################" + #CRLF$ +
          #CRLF$ +
          cCode$

; =============================
;-Create ASM Code Output Window
; =============================

; *******************************************************************************

; Workaround  : GTK3 v3.24.33 (Ubuntu 22.04 Wayland)
; Version     : v1.02.2

Global IsWayland = Bool(GetEnvironmentVariable("XDG_SESSION_TYPE") = "wayland")

Procedure GTK3_FixWindowSize(Window)
  Protected win, x, y, dx, dy, hints.GdkGeometry
  
  If IsWayland
    win = WindowID(Window)
    If Not gtk_window_get_resizable_(win)
      dx = WindowWidth(Window)
      dy = WindowHeight(Window)
      hints\max_width = 4096; 4k
      hints\max_height = 2160; 4k
      gtk_window_set_geometry_hints_(win, win, @hints, #GDK_HINT_MAX_SIZE)
      gtk_window_set_default_size_(win, dx, dy)
      gtk_window_resize_(win, dx, dy)
    EndIf
  EndIf
EndProcedure

Procedure GTK3_WindowWidth(Window)
  Protected r1
  gtk_window_get_size_(WindowID(Window), @r1, 0)
  ProcedureReturn r1
EndProcedure

Procedure GTK3_WindowHeight(Window)
  Protected r1
  gtk_window_get_size_(WindowID(Window), 0, @r1)
  ProcedureReturn r1
EndProcedure

Macro WindowWidth(Window)
  GTK3_WindowWidth(Window)
EndMacro

Macro WindowHeight(Window)
  GTK3_WindowHeight(Window)
EndMacro

; *******************************************************************************

Procedure UpdateWindow()
  ResizeGadget(#Editor_Output, #PB_Ignore, #PB_Ignore, WindowWidth(#Window_Main), WindowHeight(#Window_Main) - 40)
  ResizeGadget(#Button_OpenStandardEditor, 5, GadgetHeight(#Editor_Output) + 5, WindowWidth(#Window_Main) / 2 - 8, #PB_Ignore)
  ResizeGadget(#Button_CopyToClipboard, GadgetWidth(#Button_OpenStandardEditor) + 10, GadgetHeight(#Editor_Output) + 5,
               WindowWidth(#Window_Main) / 2 - 8, #PB_Ignore)
EndProcedure
 
; Display the ASM code in an EditorGadget
If Not OpenWindow(#Window_Main, #PB_Ignore, #PB_Ignore, 500, 500, #Program_Name, #PB_Window_SystemMenu | #PB_Window_SizeGadget |
                                                                                 #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  MessageRequester(#ErrorWindowTitle, "The program window could not be created!", #PB_MessageRequester_Error)
  End
EndIf

GTK3_FixWindowSize(#Window_Main)

CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
  If Not IsMenu(#Window_Main)
    CreateMenu(0, WindowID(#Window_Main))
  EndIf
  
  ;MenuItem(#PB_Menu_About, "")
  ;MenuItem(#PB_Menu_Preferences, "")
  MenuItem(#PB_Menu_Quit, "")
CompilerEndIf

EditorGadget(#Editor_Output, 0, 0, WindowWidth(#Window_Main), WindowHeight(#Window_Main) - 40)
ButtonGadget(#Button_OpenStandardEditor, 5, GadgetHeight(#Editor_Output) + 5, WindowWidth(#Window_Main) / 2 - 8, 30, "Open Standard Editor")
ButtonGadget(#Button_CopyToClipboard, GadgetWidth(#Button_OpenStandardEditor) + 10, GadgetHeight(#Editor_Output) + 5,
             WindowWidth(#Window_Main) / 2 - 8, 30, "Copy To Clipboard")
SetGadgetText(#Editor_Output, output$)

BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Window_Main)

Repeat
  event = WaitWindowEvent()
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button_OpenStandardEditor
          If Not OpenWithStandardProgram(cCodeFilePath$)
            file = CreateFile(#PB_Any, outputFilePathForStandardProgram$)
            If file
              WriteStringN(file, cCode$)
              CloseFile(file)
            EndIf
            If Not OpenWithStandardProgram(outputFilePathForStandardProgram$)
              MessageRequester(#ErrorWindowTitle, "The output could not be opened in the standard editor!", #PB_MessageRequester_Error)
            EndIf
          EndIf
        Case #Button_CopyToClipboard
          SetClipboardText(cCode$)
      EndSelect
    Case #PB_Event_Menu
      CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
        ; MacOS 'Application' menu
        Select EventMenu()
          Case #PB_Menu_About
          Case #PB_Menu_Preferences
          Case #PB_Menu_Quit
            Break
        EndSelect
      CompilerEndIf
  EndSelect
Until event = #PB_Event_CloseWindow
Last edited by mk-soft on Fri May 13, 2022 4:08 pm, edited 5 times in total.
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
Robeene
User
User
Posts: 15
Joined: Sun Aug 15, 2021 6:34 am

Re: PB v6.0 Beta 1 C output?

Post by Robeene »

Thanks juergenkulow, Marc56us, mk-soft
You guys are brilliant!
My purpose was to load it in Visual Studio and see if it compiles better.
I ended up with tons of errors.
I'm not knowledgeable about c or c++
I did load mk-soft tool although I think I need to pass parameters to get proper output.
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.0 Beta 1 C output?

Post by mk-soft »

You must configuration as tool in the PB-IDE
Menu -> Tool -> Configure Tool
; Tool Settings:
; - Arguments: "%FILE" "%TEMPFILE"
; - Event: Menu Or Shortcut
; For MacOS, the field "Commandline" must contain the full path to the executable
; file, e.g.: .../Program.app/Contents/MacOS/Program
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
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: PB v6.0 Beta 1 C output?

Post by Lord »

Hi!

I've got a little problem with this tool.

In a bigger program I use #PB_Editor_CompileCount and #PB_Editor_BuildCount.
The constants are select and filled in compiler options.
The pgm compiles and runs without problems with asm- and with c-backend.
But...
when using this tool to get the compiler output, I get an error:
...
Starting compilation...
Error: Line 4 - Constant not found: #PB_Editor_BuildCount
Test code:

Code: Select all

Debug #PB_Editor_CompileCount
Debug #PB_Editor_BuildCount

PgmB.s=""+#PB_Editor_BuildCount+"."+#PB_Editor_CompileCount
Debug pgmB
Image
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.0 Beta 1 C output?

Post by mk-soft »

displayC Update v1.02.1
- Added default constants: -o PB_Editor_BuildCount=0 -o PB_Editor_CompileCount=0
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
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: PB v6.0 Beta 1 C output?

Post by Lord »

Hi!

It's working now. :D

Thank you for this fast fix.
Image
Robeene
User
User
Posts: 15
Joined: Sun Aug 15, 2021 6:34 am

Re: PB v6.0 Beta 1 C output?

Post by Robeene »

mk-soft wrote: Sun Nov 28, 2021 12:28 pm You must configuration as tool in the PB-IDE
Menu -> Tool -> Configure Tool
; Tool Settings:
; - Arguments: "%FILE" "%TEMPFILE"
; - Event: Menu Or Shortcut
; For MacOS, the field "Commandline" must contain the full path to the executable
; file, e.g.: .../Program.app/Contents/MacOS/Program
Yes thank you, I did do that correctly and your tool works perfectly.
I just didn't try it out correctly as I was very tired.
Very nice tool. Thanks again.

Forgive my ignorance but when I load the C output into VS C++ and try to compile it, I get numerous errors saying something like the PB functions are undefined, among many other things that are undefined. Should there be some sort of library linked or loaded with the code? As I said, I don't know very much about c++ but I'm just wondering. My thought is that maybe MS VS C++ could optimize the code better. On that note, is there a pbcompilerc command line switch to use the highest level of optimization or is /OPTIMIZE the highest level already? Thanks
Post Reply