including c libs in c++ code?

Discussion in 'C++' started by joe, May 22, 2004.

  1. joe

    joe Guest

    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
    joe, May 22, 2004
    #1
    1. Advertising

  2. joe

    JKop Guest

    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
    JKop, May 22, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christoph
    Replies:
    2
    Views:
    516
    Richard Bos
    Sep 17, 2003
  2. Udo
    Replies:
    0
    Views:
    265
  3. Raman
    Replies:
    5
    Views:
    1,017
    Raman
    May 9, 2008
  4. James Britt
    Replies:
    9
    Views:
    117
    James Britt
    Jul 30, 2004
  5. Greg Hauptmann
    Replies:
    4
    Views:
    186
    Stefano Crocco
    Feb 7, 2009
Loading...

Share This Page