English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 10 August 2022, 18:27   #1
Cyprian
Registered User

 
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 85
VBCC Reference to undefined symbol __ctors / __dtors

Hi All,


I have faced an issue with VBCC and undefined symbol __ctors / __dtors.
I've tried a simple example like Hello World and more advanced example with window/gadget management and they show the same errors.
This is my first attempt to code Amiga with C, and unfortunately I have no idea how to fix that.
Thanks

I use VBCC (vbcc_bin_win64.zip from http://sun.hasenbraten.de/vbcc/ )


Sources for Target is taken from:
https://github.com/deplinenoise/amiga-sdk


My command line:
vc.exe +amigasdk -cpu=68000 hello.c -o hello



Error messages for C code below:
Code:
vc.lib(_main.c): In "__main":
 Error 21: vc.lib(_main.c) (CODE+0xb6): Reference to undefined symbol __ctors.
vc.lib(_main.c): In "__Exit":
Error 21: vc.lib(_main.c) (CODE+0x6): Reference to undefined symbol __dtors.
Error 21: vc.lib(_main.c) (CODE+0xc): Reference to undefined symbol __dtors.
vc.lib(stdlib/malloc.c): In "_malloc":
Error 21: vc.lib(stdlib/malloc.c) (CODE+0x64): Reference to undefined symbol _LibAllocPooled.
Error 21: vc.lib(stdlib/malloc.c) (CODE+0x3c): Reference to undefined symbol _LibCreatePool.
vc.lib(stdlib/malloc.c): In "__freemem":
Error 21: vc.lib(stdlib/malloc.c) (CODE+0x10): Reference to undefined symbol _LibDeletePool.
vc.lib(stdlib/malloc.c): In "_free":
Error 21: vc.lib(stdlib/malloc.c) (CODE+0xa6): Reference to undefined symbol _LibFreePooled.
vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib   -L"%VBCC%/targets/amiga-sdk-master/clib" -Z -mrel   "%VBCC%/targets/amiga-sdk-master/clib/startup.o" "C:\TEMP\vbcc068c.o"     -s -Rshort -lvc -o hello failed
  Press any key to continue . . .
C Code:
Code:
#include <stdio.h>

int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
 }
Target:
Code:
-cc=vbccm68k -D__AMIGA__ -D__VBCC__ -quiet %s -o= %s %s -O=%ld -I"%%VBCC%%/targets/amiga-sdk-master/sdkinclude" -I"%%VBCC%%/targets/amiga-sdk-master/netinclude"
-ccv=vbccm68k -D__AMIGA__ -D__VBCC__ %s -o= %s %s -O=%ld -I"%%VBCC%%/targets/amiga-sdk-master/sdkinclude" -I"%%VBCC%%/targets/amiga-sdk-master/netinclude"
-as=vasmm68k_mot -quiet -Fhunk -phxass %s -o %s -I"%%VBCC%%/targets/amiga-sdk-master/sdkinclude"
-asv=vasmm68k_mot -Fhunk -phxass %s -o %s -I"%%VBCC%%/targets/amiga-sdk-master/sdkinclude"
-rm=del /f %s
-rmv=del /f %s
-ld=vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -L"%%VBCC%%/targets/amiga-sdk-master/clib" -Z -mrel "%%VBCC%%/targets/amiga-sdk-master/clib/startup.o" %s %s -lvc -o %s
-l2=vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -L"%%VBCC%%/targets/amiga-sdk-master/clib" %s %s -o %s
-ldv=vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib -L"%%VBCC%%/targets/amiga-sdk-master/clib" "%%VBCC%%/targets/amiga-sdk-master/clib/startup.o" %s %s -lvc -o %s
-l2v=vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib -L"%%VBCC%%/targets/amiga-sdk-master/clib" %s %s -o %s
-ldnodb=-s -Rshort
-ul=-l%s
-cf=-F%s
-ml=500
Cyprian is offline  
Old 10 August 2022, 20:52   #2
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,218
Quote:
Originally Posted by Cyprian View Post
I have faced an issue with VBCC and undefined symbol __ctors / __dtors.
(...)
Sources for Target is taken from:
https://github.com/deplinenoise/amiga-sdk
Don't know your reasons for using that, and not the latest m68k-amigaos or m68k-kick13 target from http://sun.hasenbraten.de/vbcc/ . But did you notice it is 12 years old?

There may have been some changes since then. One of them was that vlink renamed
__ctors
to
___ctors
. Probably for SAS/C-compatibility.
phx is offline  
Old 10 August 2022, 22:36   #3
Cyprian
Registered User

 
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 85
Quote:
Originally Posted by phx View Post
But did you notice it is 12 years old?
good point. I missed the update date.
Can you recommend something newer ?
Cyprian is offline  
Old 10 August 2022, 23:10   #4
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,218
Right on top of the vbcc release page, you find:
phx is offline  
Old 10 August 2022, 23:39   #5
Cyprian
Registered User

 
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 85
thanks
, now I see following error message:
Code:
error 248 in line 5 of "proto\intuition.h": file 'exec\types.h' not found
and actually there is neither "exec" folder nor "types.h" file in that vbcc_target_m68k-amigaos.lha

I have an access to NDK13 / NDK3.2 / NDK39. Should I copy one of them INCLUDE folder to "\vbcc_target_m68k-amigaos\targets\m68k-amigaos"?


----EDIT----
fixed,
I've just copied NDK3.2 includes and added " +aos68k -lamiga -lauto" to vc.exe commandline

Last edited by Cyprian; 11 August 2022 at 00:13.
Cyprian is offline  
Old 11 August 2022, 14:00   #6
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,218
Quote:
Originally Posted by Cyprian View Post
there is neither "exec" folder nor "types.h" file in that vbcc_target_m68k-amigaos.lha
It comes without the AmigaOS NDK. Reasons are:
  • High chance that you already got it
  • You can select the NDK which you prefer (3.2, 3.9, 3.1)
  • Keep the target archive small
  • Possible Copyright issues (so we're on the safe side)
Quote:
I have an access to NDK13 / NDK3.2 / NDK39. Should I copy one of them INCLUDE folder to "\vbcc_target_m68k-amigaos\targets\m68k-amigaos"?
Either that, or copy it to a different place and enter the path with
-I...
into your config file.
BTW, NDK13 is not recommended for m68k-amigaos. You should use the m68k-kick13 target with it.
phx is offline  
Old 11 August 2022, 22:59   #7
Cyprian
Registered User

 
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 85
thanks @phx
Cyprian is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vasm / vlink undefined symbol zeGouky Coders. General 2 02 January 2019 08:49
Using libraries with VBCC (Undefined Symbol) NoBrain2k Coders. C/C++ 7 03 July 2018 12:02
Reference to undefined symbol __ldivu / __lmodu iliak Coders. C/C++ 8 25 July 2016 00:01
AsmOne: Undefined symbol copse Coders. Asm / Hardware 2 02 April 2012 01:41
Undefined symbol bsr.b init_bitmaps VoltureX Coders. General 12 13 November 2011 16:11

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Page generated in 0.07594 seconds with 15 queries