I tried to compile one of my projects and I get an error message
Does anyone have an idea for a starting point ?
I get no information about line numbers and documents.
error: use of undeclared identifier 'mov'
mov [p.v_reg_b], rbx ; backup rbx
^
purebasic.c:4106:6: error: use of undeclared identifier 'p'
mov [p.v_reg_b], rbx ; backup rbx
^
purebasic.c:4106:18: error: use of undeclared identifier 'rbx'
...
2 warnings and 18 errors generated.
Erros on macOS
Erros on macOS
macOS Catalina 10.15.7
-
- Enthusiast
- Posts: 556
- Joined: Wed Sep 25, 2019 10:18 am
Re: Erros on macOS
Fred wrote: ↑Mon Jun 28, 2021 9:50 am Inlined ASM won't work in the C backend, at least not directy like it was. We have some plans but it will need to adapt code.
Code: Select all
Procedure Test()
Protected reg_b.q
! mov [p.v_reg_b], rbx ;// backup rbx
EndProcedure
Test()
; PureBasic 6.00 Beta 1 - C Backend (Linux - x64)
; Error: Assembler
; error: ‘mov’ undeclared (first use in this function)
; mov [p.v_reg_b], rbx ;// backup rbx
; ^~~
; purebasic.c:65:3: note: each undeclared identifier is reported only once For each function it appears in
; purebasic.c:65:11: error: ‘p’ undeclared (first use in this function)
; mov [p.v_reg_b], rbx ;// backup rbx
; ^
; purebasic.c:65:23: error: ‘rbx’ undeclared (first use in this function)
; mov [p.v_reg_b], rbx ;// backup rbx
; ^~~
; purebasic.c: In function ‘SYS_Quit’:
; purebasic.c:121:1: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
; exit(PB_ExitCode);
; ^~~~
; purebasic.c:121:1: warning: incompatible implicit declaration of built-in function ‘exit’
; purebasic.c:121:1: note: include ‘<stdlib.h>’ Or provide a declaration of ‘exit’
- StarBootics
- Addict
- Posts: 984
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Erros on macOS
Does your code contain Assembler instructions some where ? Because if you try to use the C backend with Assembler code you will end up with errors like that. If so you need to wrap it like that :
Best regards
StarBootics
Code: Select all
Protected Cos.f, Sin.f
CompilerIf Defined(PB_Compiler_Backend, #PB_Constant)
CompilerIf #PB_Compiler_Backend = #PB_Backend_Asm
!FLD dword [p.v_Theta]
!FSINCOS
!FSTP dword [p.v_Cos]
!FSTP dword [p.v_Sin]
CompilerElseIf #PB_Compiler_Backend = #PB_Backend_C
Cos.f = Cos(Theta)
Sin.f = Sin(Theta)
CompilerEndIf
CompilerElse
!FLD dword [p.v_Theta]
!FSINCOS
!FSTP dword [p.v_Cos]
!FSTP dword [p.v_Sin]
CompilerEndIf
StarBootics
Last edited by StarBootics on Sat Nov 27, 2021 7:19 pm, edited 1 time in total.
The Stone Age did not end due to a shortage of stones !
Re: Erros on macOS
Yes, I forgot it, I have one function which is written in assembler.
Thanks.
Thanks.
macOS Catalina 10.15.7
Re: Erros on macOS
This works for me. So no assembler allowed in C right now...
Code: Select all
Procedure TryIt()
Protected Cos.f, Sin.f , Theta
CompilerIf Defined(PB_Compiler_Backend, #PB_Constant)
CompilerIf #PB_Compiler_Backend = #PB_Backend_Asm
Debug "Assembler"
!FLD dword [p.v_Theta]
!FSINCOS
!FSTP dword [p.v_Cos]
!FSTP dword [p.v_Sin]
CompilerElseIf #PB_Compiler_Backend = #PB_Backend_C ;words ok when in C
Debug "C backend"
Cos.f = Cos(Theta)
Sin.f = Sin(Theta)
CompilerEndIf
CompilerElse
Debug"Something else?"
!FLD dword [p.v_Theta]
!FSINCOS
!FSTP dword [p.v_Cos]
!FSTP dword [p.v_Sin]
CompilerEndIf
EndProcedure
TryIt()
MacBook Pro-M1 (2021), Sonoma 14.4.1, PB 6.10LTS M1