Thread: C++ linkage errors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    2

    C++ linkage errors

    I am porting a code which ran on HP unix to CentOS. It was a working code and compiled with gcc3.1.x and a c++ file and now I tried to compile with gcc3-3.4.6 and gcc4-4.2.4 also. But still I get this conflicts in declaration error as pasted below.

    Code:
     
    In file included from ../../../lol/ntk/nt_kslog.h:155,
    from ../../../lol/ntk/nt_kernel.h:243,
    from ../../../lol/ntk/nt_cp.h:110,
    from ../../../soml/include/soml-afi-afu.h:131,
    from ../../include/pcdb.h:58,
    from ../../include/pcdb_addtypes.h:59,
    from pcdb_addtypes.cc:94:
    
    /opt/bcs/include/syslog.h:93: error: previous declaration of 'void syslog(int, const char*, ...)' with 'C++' linkage
    /opt/bcs/include/syslog.h:93: error: conflicts with new declaration with 'C' linkage
    I have the extern "C" included like this . But still I face the same problem . What Am I missing ??

    Code:
     
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <syslog.h>
    #include <stdarg.h>
    
    #ifdef __cplusplus
    }
    #endif
    Also , I work on Centos 5 box and it compiled without any issues on one machine and the same throws this error on other box with centos and both compilers.

    Could anyone please help me , Where Am I going wrong ?
    Last edited by Salem; 01-13-2010 at 10:38 AM. Reason: tags placement

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linkage question
    By DL1 in forum C++ Programming
    Replies: 6
    Last Post: 01-13-2009, 07:56 PM
  2. internal/external linkage
    By MarkZWEERS in forum C++ Programming
    Replies: 1
    Last Post: 07-29-2008, 03:34 AM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM