Pelles C forum

Pelles C => Bug reports => Topic started by: Fuerst on January 31, 2026, 06:57:03 PM

Title: tchar.h: Missing Macro _putts (and function _putws)
Post by: Fuerst on January 31, 2026, 06:57:03 PM
compiling the source below, you get the following compiler-error because in tchar.h, the macro _putts is missing.

O:\Sources\test2\test2.c(21): warning #2018: Undeclared function '_putts' (did you mean: fputws?); assuming 'extern' returning 'int'.
 _putts(_T("Hello World"));


--- Source

#define _UNICODE

#define WORKAROUND
#undef WORKAROUND

#include <stdio.h>
#include <tchar.h> // missing _putts() (and _putws)

#if defined WORKAROUND
    /* function _putws() missed although */
#   if defined _UNICODE
#      define _putws(s) {_fputts((s), stdout); _fputts(_T("\n"), stdout); }
#       define _putts(s) _putws(s)
#   else
#      define _putts(s) puts(s)
#   endif
#endif

int main(void)
{
   _putts(_T("Hello World"));
}
Title: Re: tchar.h: Missing Macro _putts (and function _putws)
Post by: Vortex on January 31, 2026, 07:11:25 PM
msvcrt.dll exports the function _putws. Creating the import library :

\PellesC\bin\polib /OUT:msvcrt.lib /MACHINE:x86 C:\Windows\System32\msvcrt.lib
#include <stdio.h>

extern int _putws(const wchar_t *str);

int main(void)
{
_putws(L"This is a _putws test.");
return 0;
}