including c libs in c++ code?

J

joe

Hi I am trying to compile a cpp ap that runs on the system tray and checks
recently open files with clamav. i am getting a whole bunch of undefined
erros. can i link this library to a cpp program? do i need any special
confiure options?. i tried removing pthread and other libraries and the
results are similar. or should i write a small lib that checks buffers
and just use my lib with extern? thanks for the advice.

the code looks like this
extern "C" {
#include "clamav.h"

int cl_loaddbdir(const char *dirname, struct cl_node **root, int *virnum);

}

compiled with
redir -e out.txt g++ -o temp.exe myapp.cpp -mwindows -mno-cygwin -lclamav -
lz -lbz2 -lgmp

errors

/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(str.o)(.text+0x3b): In function
`cli_hex2int':
/home/john/clamav-0.71/libclamav/str.c:36: undefined reference to
`__imp___ctype_'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0x2d): In function
`cli_warnmsg':
/home/john/clamav-0.71/libclamav/others.c:63: undefined reference to
`___getreent'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0x55):/home/john/clamav-
0.71/libclamav/others.c:64: undefined reference to `___getreent'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0x9d): In function
`cli_errmsg':
/home/john/clamav-0.71/libclamav/others.c:73: undefined reference to
`___getreent'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0xc5):/home/john/clamav-
0.71/libclamav/others.c:74: undefined reference to `___getreent'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0x121): In function
`cli_dbgmsg':
/home/john/clamav-0.71/libclamav/others.c:84: undefined reference to
`___getreent'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0x14c):/home/john/clamav
-0.71/libclamav/others.c:85: more undefined references to `___getreent'
follow
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0x9db): In function
`cl_rndnum':
/home/john/clamav-0.71/libclamav/others.c:266: undefined reference to
`_gettimeofday'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0xe2b): In function
`cli_rmdirs':
/home/john/clamav-0.71/libclamav/others.c:356: undefined reference to
`_lstat'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0xe65):/home/john/clamav
-0.71/libclamav/others.c:359: undefined reference to `___errno'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0xf1e): In function
`cli_readn':
/home/john/clamav-0.71/libclamav/others.c:407: undefined reference to
`___errno'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(others.o)(.text+0xf88): In function
`cli_writen':
/home/john/clamav-0.71/libclamav/others.c:436: undefined reference to
`___errno'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(strc.o)(.text+0x13): In function
`strcasecmp':
/home/john/clamav-0.71/libclamav/zziplib/strc.c:42: undefined reference to
`__imp___ctype_'
/usr/lib/gcc-lib/i686-pc-
mingw32/3.3.1/../../../libclamav.a(dsig.o)(.text+0x3e3): In function
`cli_versig':
/home/john/clamav-0.71/libclamav/dsig.c:106: undefined reference to
`__imp___ctype_'
collect2: ld returned 1 exit status
 
J

JKop

joe posted:
Hi I am trying to compile a cpp ap that runs on the system tray and
checks recently open files with clamav. i am getting a whole bunch of
undefined erros. can i link this library to a cpp program? do i need
any special confiure options?. i tried removing pthread and other
libraries and the results are similar. or should i write a small lib
that checks buffers and just use my lib with extern? thanks for the
advice.


More off-topic than talking about cooking meat on a vegetarian newsgroup.

Here's what you want:


News server: msnews.microsoft.com
Newsgroup: microsoft.public.win32.programmer.kernel



Best of luck.


-JKop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top