Pelles C forum

C language => Beginner questions => Topic started by: tumanovalex on October 03, 2008, 08:25:45 PM

Title: How can I make program with Win32 function?
Post by: tumanovalex on October 03, 2008, 08:25:45 PM
I make simple console program:
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
void main(int argc, char* argv[]) {
  char zag[] = "Russian string\n";
  CharToOem(zag, zag);
  printf("%s",zag);
   _getch();
} //main
and get:
POLINK: error: Unresolved external symbol '__imp__CharToOemA'.
POLINK: fatal error: 1 unresolved external(s).
Help me, please. I like Pelles C.
Title: Re: How can I make program with Win32 function?
Post by: CLR on October 04, 2008, 04:08:11 AM
Hello tumanovalex.

Search for CharToOem on http://msdn.microsoft.com/ you'll get the following:
http://msdn.microsoft.com/en-us/library/ms647473.aspx

Quote
Function Information
    Minimum DLL Version   user32.dll
    Header   Declared in Winuser.h, include Windows.h
    Import library   User32.lib
    Minimum operating systems   Windows 95, Windows NT 3.1
    Unicode   Implemented as ANSI and Unicode versions.

You have to add User32.lib in your project (linker tab).
Title: Re: How can I make program with Win32 function?
Post by: tumanovalex on October 04, 2008, 08:02:51 AM
Thanks big! All has turned out!