Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what do I need to use printf()?

32 views
Skip to first unread message

Jin-Woo Lee

unread,
Nov 18, 2002, 2:05:24 PM11/18/02
to
Hello,

I just started playing around CE.Net with Platform builder 4.1 and a desktop
PC as a target platform.

I created a new platform for CEPC with tiny kernel. After that, added a new
project, "hello world example" as "WCE console application". I didn't add
any single line of code, everything was done by Platform builder. But I got
the following error:

'printf' : undeclared indentifier

I tried #include <stdio.h> at the top of the file. Still I got the same
error.
What should I do?

Thanks,


John Spaith [MS]

unread,
Nov 18, 2002, 3:37:09 PM11/18/02
to
If it's a tiny kernel image most likely you don't have the component that
includes printf in your image. Our SDK roller is smart enough to filter
printf() out of the header file so that you know it's not part of your image
at compile time. To get printf() support, you need to include from the
catalog Applications&Services Development->C Libraries&Runtimes->Standard IO
ASCII (STDIOA) and completly rebuild your platform.

However the next problem you run into is where is this going to be
displayed, since tiny kernel images don't have consoles. Instead you may
try doing OutputDebugString("Your message..."), which will make it be
displayed in the DEBUGOUT section of your PB debugger if you have a debugger
attached to the image.

--
John Spaith
Software Design Engineer, Windows CE
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.

"Jin-Woo Lee" <jl...@cornell.edu> wrote in message
news:#MeJ6VzjCHA.1812@tkmsftngp12...

Jin-Woo Lee

unread,
Nov 18, 2002, 8:50:40 PM11/18/02
to
Thanks for the comment! But I still have the same error.

I added the following four into my platform:
Catalog->Core OS->Headless devices->Applications & Services->C Libraries &
Runtimes-> Full C Runtime
-> Standard IO(STDIO)
-> Standard IO ASCII
-> Standard String Function

What else should I add?

Another question:
How can I get the printf() data displayed at the host PC through serial
port?

Thanks,
Jinwoo

"John Spaith [MS]" <jsp...@ONLINE.microsoft.com> wrote in message
news:uNja6I0jCHA.2256@tkmsftngp12...


> If it's a tiny kernel image most likely you don't have the component that
> includes printf in your image. Our SDK roller is smart enough to filter
> printf() out of the header file so that you know it's not part of your
image
> at compile time. To get printf() support, you need to include from the
> catalog Applications&Services Development->C Libraries&Runtimes->Standard
IO
> ASCII (STDIOA) and completly rebuild your platform.
>
> However the next problem you run into is where is this going to be
> displayed, since tiny kernel images don't have consoles. Instead you may
> try doing OutputDebugString("Your message..."), which will make it be
> displayed in the DEBUGOUT section of your PB debugger if you have a
debugger
> attached to the image.
>
> --
> John Spaith
> Software Design Engineer, Windows CE
> Microsoft Corporation
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.

> You assume all risk for your use. ?2002 Microsoft Corporation. All rights

John Spaith [MS]

unread,
Nov 20, 2002, 8:38:51 PM11/20/02
to
Hmm... I'm not sure why your printf() isn't showing up. Check the date on
the file %YourProjectName%\cesysgen\sdk\inc\stdlib.h to make sure that it
was updated when you rebuilt your platform. As a last resort try #including
the file stdlib using the absolute path of this file to make sure that
there's no other stdlib.h somehow screwing things up, though I don't think
this is the problem.

To make the output be redirected, you need to use a not so well docced API
(will be docced in CE 4.2) that will change the default STDIO path.
Function name is SetStdioPathW, which changes where standard
input/output/err are sent to. You basically want something like:

SetStdioPathW(0, L"COM1:"); // or whatever your COM port driver name is
SetStdioPathW(1, L"COM1:");
SetStdioPathW(2, L"COM1:");

To get SetStdioPathW definition you need to "#define WINCEOEM=1" before you
include any include files. Look at Telnet Server
(\public\servers\sdk\samples\telnetd) to see this in action.

If push comes to shove you can also do a CreateFile("COM1:") (or your port)
and then do WriteFile(handle,szData,...). Not as convenient as printf,
though.

--
John Spaith
Software Design Engineer, Windows CE
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.

"Jin-Woo Lee" <jl...@cornell.edu> wrote in message

news:#juLY42jCHA.1428@tkmsftngp11...

Jin-Woo Lee

unread,
Nov 22, 2002, 4:51:45 PM11/22/02
to
Thanks, I could build after removing winsock.lib from
Project->Setting->Link->Object/Library module. Tiny Kernel project may not
need "winsock.lib".

I still have problem with SetStdioPathW(). What should I include into my
program to use it?
I got the error message like:
'SetStdioPathW' : undeclared identifier

I couldn't even find it from PB help.

Thanks,
Jinwoo

"John Spaith [MS]" <jsp...@ONLINE.microsoft.com> wrote in message

news:O5Ll#6PkCHA.2204@tkmsftngp08...

Paul G. Tobey [eMVP]

unread,
Nov 22, 2002, 5:20:04 PM11/22/02
to
A quick ten second search using Windows Explorer's Find... ability shows
pkfuncs.h in \public\common\oak\inc includes the definition of that call.

Paul T.

"Jin-Woo Lee" <jl...@cornell.edu> wrote in message

news:Ou#DTFnkCHA.1860@tkmsftngp09...

0 new messages