+
 新版

如何用LDAP头文件编译程序?

rayeaster 发布于 2012/08/31 17:49
阅读 848
收藏 0

我在程序目录下面拷贝了从OpenLDAP的得到的以下头文件:

ldpa.h/lber.h/ldap_cdefs.h/ldap_features.h/lber_types.h

但是用nmake编译是有以下错误。  (makefile在错误信息后面)

  
     G:\cworkspace\test>nmake test
    
    Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            cl /I. /IC:\Sybase\OCS-15_0\include -DUSE_SIG_HANDLER=0 /W3 /MD /nologo
    /Zi /DWIN32 -Fotest.obj -c test.c
    test.c
    G:\cworkspace\test\lber_types.h(42) : error C2061: syntax error : identifier 'be
    r_int_t'
    G:\cworkspace\test\lber_types.h(42) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber_types.h(45) : error C2061: syntax error : identifier 'be
    r_sint_t'
    G:\cworkspace\test\lber_types.h(45) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber_types.h(46) : error C2061: syntax error : identifier 'be
    r_uint_t'
    G:\cworkspace\test\lber_types.h(46) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber_types.h(49) : error C2061: syntax error : identifier 'be
    r_tag_t'
    G:\cworkspace\test\lber_types.h(49) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber_types.h(52) : error C2061: syntax error : identifier 'be
    r_socket_t'
    G:\cworkspace\test\lber_types.h(52) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber_types.h(55) : error C2061: syntax error : identifier 'be
    r_len_t'
    G:\cworkspace\test\lber_types.h(55) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber_types.h(58) : error C2061: syntax error : identifier 'be
    r_slen_t'
    G:\cworkspace\test\lber_types.h(58) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(191) : error C2061: syntax error : identifier 'ber_sle
    n_t'
    G:\cworkspace\test\lber.h(193) : error C2143: syntax error : missing ')' before
    '*'
    G:\cworkspace\test\lber.h(193) : error C2143: syntax error : missing '{' before
    '*'
    G:\cworkspace\test\lber.h(193) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(194) : error C2146: syntax error : missing ')' before
    identifier 'len'
    G:\cworkspace\test\lber.h(194) : error C2081: 'ber_len_t' : name in formal param
    eter list illegal
    G:\cworkspace\test\lber.h(194) : error C2061: syntax error : identifier 'len'
    G:\cworkspace\test\lber.h(194) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(194) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(197) : error C2059: syntax error : '}'
    G:\cworkspace\test\lber.h(213) : error C2016: C requires that a struct or union
    has at least one member
    G:\cworkspace\test\lber.h(213) : error C2061: syntax error : identifier 'ber_len
    _t'
    G:\cworkspace\test\lber.h(215) : error C2059: syntax error : '}'
    G:\cworkspace\test\lber.h(217) : error C2143: syntax error : missing '{' before
    '*'
    G:\cworkspace\test\lber.h(245) : error C2061: syntax error : identifier 'ber_get
    _tag'
    G:\cworkspace\test\lber.h(245) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(246) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(249) : error C2061: syntax error : identifier 'ber_ski
    p_tag'
    G:\cworkspace\test\lber.h(249) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(251) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(254) : error C2061: syntax error : identifier 'ber_pee
    k_tag'
    G:\cworkspace\test\lber.h(254) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(256) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(259) : error C2061: syntax error : identifier 'ber_ski
    p_element'
    G:\cworkspace\test\lber.h(259) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(261) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(264) : error C2061: syntax error : identifier 'ber_pee
    k_element'
    G:\cworkspace\test\lber.h(264) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(266) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(269) : error C2061: syntax error : identifier 'ber_get
    _int'
    G:\cworkspace\test\lber.h(269) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(271) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(274) : error C2061: syntax error : identifier 'ber_get
    _enum'
    G:\cworkspace\test\lber.h(274) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(276) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(279) : error C2061: syntax error : identifier 'ber_get
    _stringb'
    G:\cworkspace\test\lber.h(279) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(282) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(292) : error C2061: syntax error : identifier 'ber_get
    _stringbv'
    G:\cworkspace\test\lber.h(292) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(295) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(298) : error C2061: syntax error : identifier 'ber_get
    _stringa'
    G:\cworkspace\test\lber.h(298) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(300) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(303) : error C2061: syntax error : identifier 'ber_get
    _stringal'
    G:\cworkspace\test\lber.h(303) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(305) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(308) : error C2061: syntax error : identifier 'ber_get
    _bitstringa'
    G:\cworkspace\test\lber.h(308) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(311) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(314) : error C2061: syntax error : ientifier 'ber_get
    _null'
    G:\cworkspace\test\lber.h(314) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(315) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(318) : error C2061: syntax error : identifier 'ber_get
    _boolean'
    G:\cworkspace\test\lber.h(318) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(320) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(323) : error C2061: syntax error : identifier 'ber_fir
    st_element'
    G:\cworkspace\test\lber.h(323) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(326) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(329) : error C2061: syntax error : identifier 'ber_nex
    t_element'
    G:\cworkspace\test\lber.h(329) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(332) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(335) : error C2061: syntax error : identifier 'ber_sca
    nf'
    G:\cworkspace\test\lber.h(335) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(338) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(436) : error C2061: syntax error : identifier 'ber_ski
    p_data'
    G:\cworkspace\test\lber.h(436) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(438) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(441) : error C2061: syntax error : identifier 'ber_rea
    d'
    G:\cworkspace\test\lber.h(441) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(444) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(447) : error C2061: syntax error : identifier 'ber_wri
    te'
    G:\cworkspace\test\lber.h(447) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(451) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(492) : error C2061: syntax error : identifier 'ber_get
    _next'
    G:\cworkspace\test\lber.h(492) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(495) : error C2059: syntax error : ')'
    G:\cworkspace\test\lber.h(647) : error C2061: syntax error : identifier 'ber_str
    nlen'
    G:\cworkspace\test\lber.h(647) : error C2059: syntax error : ';'
    G:\cworkspace\test\lber.h(648) : error C2059: syntax error : ')'
    G:\cworkspace\test\ldap.h(246) : error C2079: 'ldctl_value' uses undefined struc
    t 'berval'
    G:\cworkspace\test\ldap.h(916) : error C2079: 'ls_cookie' uses undefined struct
    'berval'
    G:\cworkspace\test\ldap.h(1646) : error C2079: 'la_attr' uses undefined struct '
    berval'
    G:\cworkspace\test\ldap.h(1647) : error C2079: 'la_value' uses undefined struct
    'berval'
    G:\cworkspace\test\ldap.h(2185) : error C2016: C requires that a struct or union
     has at least one member
    G:\cworkspace\test\ldap.h(2185) : error C2061: syntax error : identifier 'ber_in
    t_t'
    G:\cworkspace\test\ldap.h(2186) : error C2061: syntax error : identifier 'ldvlv_
    before_count'
    G:\cworkspace\test\ldap.h(2186) : fatal error C1003: error count exceeds 100; st
    opping compilation
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
    \cl.EXE"' : return code '0x2'
    Stop.


makefile 文件:
#############################################################################
#
# Microsoft makefile for sample programs
#
#############################################################################

MAKEFILE=MAKEFILE

COMPILE_DEBUG = 1

# Compiler AND linker flags 
!ifdef COMPILE_DEBUG
CFLAGS = /W3 /MD /nologo /Zi /DWIN32 
LFLAGS= /MAP /SUBSYSTEM:CONSOLE /DEBUG /DEBUGTYPE:cv 
!else
CFLAGS = /W3 /MD /nologo /Od /DWIN32
LFLAGS= /MAP /SUBSYSTEM:CONSOLE
!endif

ASYNCDEFS = -DUSE_SIG_HANDLER=0

#
# Where to get includes and libraries
#
SYSLIBS =	kernel32.lib advapi32.lib msvcrt.lib

###############################################################

all: test

test: $*.exe
	 

# The generalized how to make an .obj rule
.c.obj:
    cl /I. /I$(ASYNCDEFS) $(CFLAGS) -Fo$@ -c $<

test.exe: test.obj $(MAKEFILE)
    link $(LFLAGS) -out:$*.exe $*.obj
    mt -manifest $*.exe.manifest -outputresource:$*.exe
    rm $*.exe.manifest

clean:
	-del *.obj 
	-del *.map 
	-del *.exe 
	-del *.err
	-del *.ilk
	-del *.pdb


加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部