7

I am rewriting a c program which was used to linux, now I'll reused it on windows, I write a bat file. I run this file as administrator, then error occurs: syslog.h:No such file or directory.

Could you please give me some advices? thx.

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
diligent
  • 2,282
  • 8
  • 49
  • 64

3 Answers3

6

Probably the program you are porting to windows uses the syslog(3) function call (in addition to openlog and closelog). These are defined in syslog.h on unix. Windows does not have these, so you can do the following:

  • Remove syslog.h and these function calls from the code.
  • Create a syslog.h and implement these calls or just define them as empty macros.
  • Use cygwin which provides POSIX compatibility.
b0ti
  • 2,319
  • 1
  • 18
  • 18
2

Windows doesn't offer a built-in syslog client. You may be able to use a third-party library, such as http://syslog-win32.sourceforge.net.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • thanks Greg, I download the syslog-win32-0.3.tar.bz2 not the exe format. I unzip it , but it has a lot of files, where should I start, how can I use this tool ? thanks. – diligent Feb 29 '12 at 09:12
  • I don't know, I've never used it. I just searched Google for "win32 syslog client" and that turned up. – Greg Hewgill Feb 29 '12 at 09:18
  • Sorry to see this very promising project uses the Gnome glib library. Unlike every other lib I've used in 30 years, the Gnome libs make every effort to be as invasive as possible, and including even the tiniest aspect of glib drags in the whole damned library, or close to it. It's just insidious in how it tries to impose itself at every imaginable turn. Just say NO! –  Mar 27 '14 at 00:32
  • 1
    There is another project of the same name: https://github.com/asankah/syslog-win32 – pevik Apr 05 '16 at 10:57
1

In PHP source code you can find a wrapper based on Windows function ReportEvent().

E.g.: take a look at wsyslog.c and syslog.h

Edit: have you tried syslog-server?

oHo
  • 51,447
  • 27
  • 165
  • 200
A T
  • 13,008
  • 21
  • 97
  • 158
  • @JeremiahGowdy I agree with your remark and have updated the answer. What do you think of my rephrase? You may delete your previous comment. Cheers – oHo Jan 25 '17 at 16:26