Implicit Declaration errors
When trying to build the current version, I'm getting the following issue:
[ 1%] Building C object CMakeFiles/Plugins.dir/src/Plugins/GoatTracker/gt2/gconsole.c.o
/home/evil/src/RetroDebugger/src/Emulators/atari800/esc.c: In function ‘ESC_Run’:
/home/evil/src/RetroDebugger/src/Emulators/atari800/esc.c:154:9: error: implicit declaration of function ‘c64d_show_message’ [-Wimplicit-function-declaration]
154 | c64d_show_message(buf); //"CPU JAM has occured");
| ^~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/EmulatorAtari800.dir/build.make:230: CMakeFiles/EmulatorAtari800.dir/src/Emulators/atari800/esc.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/EmulatorAtari800.dir/all] Error 2
Note that this does not appear to be the only file with this issue:
[ 27%] Building C object CMakeFiles/EmulatorVice.dir/src/Emulators/vice/gfxoutputdrv/gfxoutput.c.o
/home/evil/src/RetroDebugger/src/Emulators/vice/gfxoutputdrv/gfxoutput.c: In function ‘gfxoutput_early_init’:
/home/evil/src/RetroDebugger/src/Emulators/vice/gfxoutputdrv/gfxoutput.c:128:5: error: implicit declaration of function ‘gfxoutput_init_godot’; did you mean ‘gfxoutput_init_koala’? [-Wimplicit-function-declaration]
128 | gfxoutput_init_godot(help);
| ^~~~~~~~~~~~~~~~~~~~
| gfxoutput_init_koala
make[2]: *** [CMakeFiles/EmulatorVice.dir/build.make:622: CMakeFiles/EmulatorVice.dir/src/Emulators/vice/gfxoutputdrv/gfxoutput.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:169: CMakeFiles/EmulatorVice.dir/all] Error 2
We also have these in pokeyrec.c:
[ 26%] Building C object CMakeFiles/EmulatorAtari800.dir/src/Emulators/atari800/pia.c.o
/home/evil/src/RetroDebugger/src/Emulators/atari800/pokeyrec.c: In function ‘POKEYREC_Initialise’:
/home/evil/src/RetroDebugger/src/Emulators/atari800/pokeyrec.c:75:24: error: implicit declaration of function ‘Util_sscandec’ [-Wimplicit-function-declaration]
75 | interval = Util_sscandec(argv[++i]);
| ^~~~~~~~~~~~~
/home/evil/src/RetroDebugger/src/Emulators/atari800/pokeyrec.c:77:17: error: implicit declaration of function ‘Log_print’ [-Wimplicit-function-declaration]
77 | Log_print("Negative interval not allowed");
| ^~~~~~~~~
/home/evil/src/RetroDebugger/src/Emulators/atari800/pokeyrec.c:84:24: error: implicit declaration of function ‘Util_strdup’ [-Wimplicit-function-declaration]
84 | filename = Util_strdup(argv[++i]);
| ^~~~~~~~~~~
/home/evil/src/RetroDebugger/src/Emulators/atari800/pokeyrec.c:84:22: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
84 | filename = Util_strdup(argv[++i]);
| ^
make[2]: *** [CMakeFiles/EmulatorAtari800.dir/build.make:272: CMakeFiles/EmulatorAtari800.dir/src/Emulators/atari800/pokeyrec.c.o] Error 1
gcc also complains about a lot of incompatible pointer types:
/home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c: In function ‘initscreen’:
/home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c:85:26: error: assignment to ‘unsigned int *’ from incompatible pointer type ‘unsigned char *’ [-Wincompatible-pointer-types]
85 | rgbaPixelsBuffer = gtGetRgbaPixelsBuffer();
| ^
/home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c: In function ‘fliptoscreen’:
/home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c:389:47: error: initialization of ‘unsigned char *’ from incompatible pointer type ‘unsigned int *’ [-Wincompatible-pointer-types]
389 | unsigned char *dptr = rgbaPixelsBuffer + y *16 * pitch + x*8; //+1;
| ^~~~~~~~~~~~~~~~
To Reproduce Steps to reproduce the behavior: cd RetroDebugger mkdir build cd build cmake ./../ make clean make
The first error seems valid, at first glance... it looks like that first function is declared in ViceWrapper.h. If I add an include for it, the error goes away.
The second error also goes away, if I just uncomment '//#include "godotdrv.h"' on line 44.
The third set of errors goes away by adding a-util.h and a-log.h to the pokeyrec.c includes.
However... There are still seven other incompatible pointer types and other errors yet to fix, so I'm wondering if I'm going down the wrong path here... if this somehow builds for everyone else on Linux.
- OS: Ubuntu Noble Numbat (24.04)
- Version: Git as of 24/03/29
Thanks for reporting. This may be related to #27 and #30
I usually compile this under older version of Debian and I did not hit these issues, as binaries were created and are available also in this repo. Although something may be still missing. I need to review this from ground up again on newest versions of Linux as something seems to be odd.
The error you experience is about implicit function declaration that on my GCC is configured as a warning only. I'll check and force that as error to fix possible problems. As a workaround please check how to avoid that warning as error and replace back to be warning in your gcc configuration.
Thanks for giving this some attention - I look forward to future releases of this very cool tool!
I've added -fpermissive in CMakeLists.txt, it should compile now. Please confirm.
It still appears to fail due to the incompatible pointer types, other errors are gone:
[ 2%] Building C object CMakeFiles/Plugins.dir/src/Plugins/GoatTracker/gt2/gconsole.c.o /home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c: In function ‘initscreen’: /home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c:85:26: error: assignment to ‘unsigned int *’ from incompatible pointer type ‘unsigned char *’ [-Wincompatible-pointer-types] 85 | rgbaPixelsBuffer = gtGetRgbaPixelsBuffer(); | ^ /home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c: In function ‘fliptoscreen’: /home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/gconsole.c:389:47: error: initialization of ‘unsigned char *’ from incompatible pointer type ‘unsigned int *’ [-Wincompatible-pointer-types] 389 | unsigned char *dptr = rgbaPixelsBuffer + y *16 * pitch + x*8; //+1;
Interesting, this does not happen on my GCC.
Anyway, this is in GoatTracker2 code and types there are not defined strictly. Fix seems simple, replace:
Line 85 in gconsole.c with:
rgbaPixelsBuffer = (unsigned*)gtGetRgbaPixelsBuffer();
and Line 389 in gconsole.c with:
unsigned char *dptr = ((unsigned char*)rgbaPixelsBuffer) + y *16 * pitch + x*8;
Please check this and let me know if there's anything else that fails.
Those two fixes do fix the incompatible pointer types, but (even with the -fpermissive confirmed in CMakeList), it looks like it's hitting implicit function declarations further along.
[ 3%] Building C object CMakeFiles/Plugins.dir/src/Plugins/GoatTracker/gt2/goattrk2.c.o
/home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/goattrk2.c: In function ‘mousecommands’:
/home/evil/src/RetroDebugger/src/Plugins/GoatTracker/gt2/goattrk2.c:908:9: error: implicit declaration of function ‘sound_init’; did you mean ‘gtsound_init’? [-Wimplicit-function-declaration]
908 | sound_init(b, mr, writer, hardsid, sidmodel, ntsc, multiplier, catweasel, interpolate, customclockrate);
| ^~~~~~~~~~
| gtsound_init
I worked around it by adding 'set (CMAKE_C_FLAGS "-Wno-implicit-function-declaration")' to the CMakeLists.txt.
It then went further and I started hitting a bunch of these:
/home/evil/src/RetroDebugger/src/Emulators/vice/root/util.h:48:8: error: unknown type name ‘BYTE’; did you mean ‘UBYTE’?
48 | extern BYTE *util_bufcat(BYTE *buf, int *buf_size, size_t *max_buf_size,
| ^~~~
| UBYTE
I'm guessing this doesn't happen when compiling for Windows because Visual Studio has a non-standard define for BYTE. It shouldn't happen on Linux either due to the include for types.h. Howerver, that include in util.h doesn't point to the correct path "../arch/types.h", so I suspect it's just being skipped. Giving it the relative path fixed the problem of BYTE and WORDs not being defined.
The next thing I bumped up against was:
/home/evil/src/RetroDebugger/src/Emulators/atari800/pokeyrec.c:84:22: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
84 | filename = Util_strdup(argv[++i]);
| ^
As a quick hackaround I just added -Wno-int-conversion to the compile flags - since I expected I might find many more conversion hits if I just fixed that one.
Next, I hit:
/home/evil/src/RetroDebugger/src/Emulators/atari800/sdl/a-main.c:173:41: error: passing argument 2 of ‘Atari800_Initialise’ from incompatible pointer type [-Wincompatible-pointer-types]
173 | if (!Atari800_Initialise(&argc, argv))
| ^~~~
| |
| char **
In file included from /home/evil/src/RetroDebugger/src/Emulators/atari800/sdl/a-main.c:39:
/home/evil/src/RetroDebugger/src/Emulators/atari800/atari.h:126:48: note: expected ‘const char **’ but argument is of type ‘char **’
126 | int Atari800_Initialise(int *argc, const char *argv[]);
| ~~~~~~~~~~~~^~~~~~
That one may bear some more looking into, but in a hurry I just added -Wno-incompatible-pointer-types to the compiler flags.
It got a lot further into the compile after that, and eventually broke at
[ 37%] Building CXX object CMakeFiles/EmulatorVice.dir/src/Emulators/vice/sid/resid-fp.cpp.o
In file included from /home/evil/src/RetroDebugger/src/Emulators/vice/sid/sid.h:35,
from /home/evil/src/RetroDebugger/src/Emulators/vice/sid/resid-fp.cpp:51:
/home/evil/src/RetroDebugger/src/Emulators/vice/root/sound.h:105:18: error: ‘SWORD’ has not been declared
105 | int (*write)(SWORD *pbuf, size_t nr);
| ^~~~~
This seems to be the same problem as seen above where "types.h" is included, but it's not in the same directory and therefore not found. I updated it to the relative path.
Then, I ran into the same thing with vicii.h not finding types.h. Relative-pathed ftw.
mos6510.h - same problem, same fix.
attach.h - same.
...and snapshot.h. and debug.h, and gfxoutput.h, and datasette.h.... About this time I was thinking about adding an include path to the options, but was worried that it might create conflicts for the non-vice files. So, my quick fix was to open the vice src directory in VS Code, do a 'replace in files', and change #include "types.h" in the remaining 400+ files to point to the relative path (excluding arch/ directory).
And that did it! It now compiles (and appears to be running) with gcc 14.0.1 20240412 (experimental).
The problem with BYTE not being defined is the same problem as #27 I fixed this on private branch by replacing name "types.h" with "vicetypes.h", I'll add a proper fix for this with next release. Glad it finally compiles for you.
Cool! Thanks for taking the time to help out us Linux/C64 enthusiasts. Your efforts are appreciated!