Problem compiling SNMP++ v3.1.3a
Alex Finogenov
afinogenov____malibunet.com
Fri Jul 27 17:04:39 CEST 2001
Hi,
When I tried to compile the latest SNMP++ on x86 SunOS 5.8 using g++/gcc and
either make or gmake I get the following error immediately:
address.cpp: Im methog 'int IpAddress::parse_dotted_ipstring(const char *)':
address.cpp:446: implicit declaration of function 'int strtok_r(...)'
address.cpp:446: assignment to 'char *' from 'int' lacks a cast
address.cpp:471: assignment to 'char *' from 'int' lacks a cast
This was a bit frustrating since I used the Makefile & common.mk that I
modified to compile the previous release of SNMP++ without a single warning.
Anyway, here is the Makefile that does make compile on Solaris x86. Note, it
does not use threads. I used gmake to run it.
############################################################################
##
# Makefile for Solaris x86 & GNU compilers
############################################################################
##
COPTIONS = -D_XPG4_EXTENDED -Dsun -D__unix -Wall -D__EXTENSIONS__
-D_REENTRANT
#-D_THREADS
TEMPOPTS = -I. -I../include
USEROPTS = -g
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(CFLAGS) -L/usr/gnu/lib/gcc-lib/i386-pc-solaris2.7/2.95.3
SHARED = -fPIC -shared
SYSLIBS = \
-lsocket \
-lgcc
# CC must be switched from g++ to gcc on a failure to produce .so and back
#after it succeeded, but failed on the last stage.
GCC = gcc
CC = g++
LD = ld
include common.mk
############################################################################
##
The common.mk needed very little change: the first token in the 2nd line in
the following snippet had to be changed from $(CC) to $(GCC).
############################################################################
##
# common.mk for Solaris x86 & GNU compilers
############################################################################
##
...
$(LIBSNMPPLUS_SHARED): $(OBJS_SHARED)
$(GCC) $(SHARED) $(LDFLAGS) $(OBJS_SHARED) -o $@
...
############################################################################
##
The agent++ was compiled successfully with the Makefile.linux without any
modifications.
Thanks,
Alex
More information about the AGENTPP
mailing list