Trying to rebuild an old program and now get complaints about conio.h:
C:\Program Files\Pelles C\Include\conio.h(50): error #2019: Invalid use of __declspec(vaformat).
Line 50 in conio.h looks like:
extern _CRTIMP _CRTCHK(printf,1,2) int __cdecl _cprintf(const char * restrict, ...);
The code with which I am working looks like this:
#include <conio.h> /* for textcolor and backgroundcolor */
_textcolor(1); /* dark blue; very hard to see */
fprintf(stderr, "rlog %s: ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789\n\r", gszCmdId);
_textcolor(2); /* green; very hard to see */
I googled __declspec and saw references to C++ and MSVC but couldn't really figure out anything. What am I doing wrong? Thanks.
The _CRTCHK(printf,1,2) part of line 50 will expand from this:
#define _CRTCHK(f,n,m) __declspec(vaformat(f,n,m))
which normally works fine with Pelles C.
I'm not sure why things are failing for you. Wild guess: do you have a conflicting #define printf somewhere?
This is only thing I see:
:-[ Find "define printf".
"C:\Users\philg\Documents\C Programming\RCSW\Native Windows_04_11_2020\config.h" (196) #define printf_string( m, n ) __attribute__ ( ( format (printf, m, n ) ) )
"C:\Users\philg\Documents\C Programming\RCSW\Native Windows_04_11_2020\config.h" (198) #define printf_string( m, n )
"C:\Users\philg\Documents\C Programming\RCSW\Native Windows_04_11_2020\config.h" (203) #define printf_string_exiting( m, n ) __attribute__ ( ( format (printf, m, n ), noreturn ) )
"C:\Users\philg\Documents\C Programming\RCSW\Native Windows_04_11_2020\config.h" (205) #define printf_string_exiting( m, n ) printf_string ( m, n )
4 hit(s)
This code, these modules, are ancient and originally written as console programs.