16 October 2018, 20:24 | #1 |
Registered User
Join Date: Oct 2017
Location: Germany
Posts: 193
|
VBCC and enums
Does anyone know if VBCC supports enum types? I'm using the following version;
Code:
vbcc V0.9f (c) in 1995-2017 by Volker Barthelmann vbcc code-generator for m68k/ColdFire V1.11 (c) in 1995-2017 by Volker Barthelmann https://github.com/PR77/68000_Relocator_FLASH_Kickstart When compiling I get the following error; Code:
>tFlashCommandStatus checkFlashStatus(ULONG address) warning 57 in line 58 of "FlashKickstart.c": , expected >tFlashCommandStatus warning 126 in line 59 of "FlashKickstart.c": no declarator in prototype >tFlashCommandStatus warning 126 in line 59 of "FlashKickstart.c": no declarator in prototype >tFlashCommandStatus unlockFlashDevice(ULONG address) warning 57 in line 59 of "FlashKickstart.c": , expected >tFlashCommandStatus warning 126 in line 60 of "FlashKickstart.c": no declarator in prototype >tFlashCommandStatus warning 126 in line 60 of "FlashKickstart.c": no declarator in prototype >tFlashCommandStatus readManufactureID(ULONG address, warning 57 in line 60 of "FlashKickstart.c": , expected >tFlashCommandStatus readManufactureID(ULONG address, UWORD * warning 57 in line 60 of "FlashKickstart.c": , expected >tFlashCommandStatus readManufactureID(ULONG address, UWORD * error 20 in line 60 of "FlashKickstart.c": no declarator and no identifier in prototype aborting... |
16 October 2018, 20:45 | #2 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I’m sure I’ve used enums with vbcc. Maybe it’s the typedef that’s the problem. What happens if you give the enum a name (after the enum keyword) and then change the prototypes to refer to enum thatname?
|
16 October 2018, 21:49 | #3 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
The enum and typedef is fine, but the rest of the program is completely broken; undefined types, usage of undeclared variables, function-calls that don't match the prototype etc.
|
16 October 2018, 21:51 | #4 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
As far as I can see your are using AmigaOS typedefs (like ULONG) and AmigaOS system calls, without including any AmigaOS header files.
The errors are due to ULONG being undefined. It is defined in exec/types.h. And I would also recommend to include <proto/exec.h> and <proto/expansion.h>, but I didn't check the whole source... |
16 October 2018, 21:55 | #5 |
Registered User
Join Date: Oct 2017
Location: Germany
Posts: 193
|
It is the very first cut of the code. I have no expectation that it will compile, I just cant seem to get past the issue with the compile complaining about the function prototypes.
|
16 October 2018, 21:57 | #6 | |
Registered User
Join Date: Oct 2017
Location: Germany
Posts: 193
|
Quote:
Code:
C:\Users\Paul\Documents\Amiga\FLASH_KICKSTART\Rev1\Software>vc FlashKickstart.c >#define NULL 0 error 272 in line 30 of "exec\types.h": macro 'NULL' redefined unidentically included from file "C:\vbcc\targets\m68k-kick13\include/proto\exec.h":5 included from file "FlashKickstart.c":5 1 error found! vbccm68k -c99 -quiet -hunkdebug "FlashKickstart.c" -o= "C:\Users\Paul\AppData\Local\Temp\vbcc068c.asm" -O=1 -no-cpp-warn -I"C:\vbcc\targets\m68k-kick13\include" -I"C:\vbcc\ndk13\include_h" failed The code is really the first cut, and I can't seem to get past the enum issue. |
|
16 October 2018, 22:10 | #7 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I reckon Phx is right. Errors about things being redefined are due to incorrect ordering of the includes. At least in my experience.
|
18 October 2018, 12:08 | #8 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
The problem is Commodore's exec/types.h and stdlib.h both define NULL. But unidentically. exec/types.h assigns 0L, while the standard headers use (void *)0, which is better because it causes an error when NULL is assigned to integers.
Usually including both, exec/types.h and stdlib.h, shouldn't be a problem, because stdlib.h does an #undef NULL before redefining it, and the official AmigaOS NDK3.1 and 3.9 headers do an #ifndef NULL check. So you are probably using old Commodore headers (Kickstart 1.3 maybe?). Then you should try to include the standard headers behind them. |
20 October 2018, 13:44 | #9 |
Registered User
Join Date: Oct 2017
Location: Germany
Posts: 193
|
Thanks PHX! Now compiles but fails to link;
Code:
C:\Users\Paul\Documents\Amiga\FLASH_KICKSTART\Rev1\Software>vc FlashKickstart.c > printf("cd_BoardAddr = %lx\n", myCD->cd_BoardAddr); warning 214 in line 320 of "FlashKickstart.c": suspicious format string > printf("cd_BoardSize = %lx (%ldK)\n", myCD->cd_BoardSize,((ULONG)myCD-> warning 214 in line 321 of "FlashKickstart.c": suspicious format string > print("Could not open specific Kickstart image [%s]", argv[1]); warning 161 in line 361 of "FlashKickstart.c": implicit declaration of function <print> \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l73": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x28e): Reference to undefined symbol _OpenLibrary. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l77": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x2bc): Reference to undefined symbol _FindConfigDev. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l79": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x2d8): Reference to undefined symbol _CloseLibrary. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l88": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x37e): Reference to undefined symbol _CloseLibrary. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l93": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x3e4): Reference to undefined symbol _CloseLibrary. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l99": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x420): Reference to undefined symbol _CloseLibrary. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l95": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x400): Reference to undefined symbol _Open. \Users\Paul\AppData\Local\Temp\vbcc068c.o: In "l98": Error 21: \Users\Paul\AppData\Local\Temp\vbcc068c.o (CODE+0x416): Reference to undefined symbol _print. vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -Z -mrel "C:\vbcc\targets\m68k-kick13\lib\startup.o" "C:\Users\Paul\AppData\Local\Temp\vbcc068c.o" -s -L"C:\vbcc\targets\m68k-kick13\lib" -L"C:\vbcc\ndk13\lib" -lvc -o a.out failed Last edited by PR77; 20 October 2018 at 13:44. Reason: KS base reference |
20 October 2018, 15:18 | #10 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
I guess you didn't include <proto/exec.h> and <proto/expansion.h>, but just <clib/...> from the Commodore headers, so function calls are not inlined but done via stub routines from amiga.lib.
You have to link with "-lamiga". "print" is probably a typo. Did you mean "printf"? |
22 October 2018, 15:23 | #11 | |
Registered User
Join Date: Oct 2017
Location: Germany
Posts: 193
|
Quote:
|
|
25 May 2019, 23:29 | #12 |
Registered User
Join Date: Oct 2017
Location: Germany
Posts: 193
|
Anyway know why VBCC throughs warning 214? Better still, what is wrong with the following printf(…)
Code:
printf("cd_BoardAddr = 0x%X\n", myCD->cd_BoardAddr); |
26 May 2019, 10:29 | #13 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
It's probably a pointer type, casting it to ULONG or formatting with %p should get rid of the warning.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
vbcc IDE | iliak | Coders. C/C++ | 23 | 23 April 2019 17:27 |
VBCC - What's going on here? | deimos | Coders. C/C++ | 69 | 28 July 2018 16:14 |
VBCC and #include | majikeyric | Coders. C/C++ | 3 | 03 March 2016 15:07 |
vbcc 0.9d | phx | News | 43 | 13 July 2015 19:41 |
vbcc: no startup | aragon | Coders. C/C++ | 2 | 16 February 2014 14:52 |
|
|