Mail Archives: djgpp/1999/03/17/23:10:58
From: | henrypijames AT mailcity DOT com (Henry 'Pi' James)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Undefined reference?
|
Date: | Thu, 18 Mar 1999 03:22:03 GMT
|
Organization: | University of Karlsruhe
|
Lines: | 300
|
Message-ID: | <36f06f5e.590365630@nntp.rz.uni-karlsruhe.de>
|
NNTP-Posting-Host: | isdn216-85.rz.uni-karlsruhe.de
|
Mime-Version: | 1.0
|
X-Trace: | news.rz.uni-karlsruhe.de 921727137 25780 129.13.216.85
|
X-Complaints-To: | usenet AT rz DOT uni-karlsruhe DOT de
|
X-Newsreader: | Forte Agent 1.5/32.451
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi!
As a DJGPP beginner , I use RHIDE to somehow test around. Soon I came
to a problem. I wrote the following codes.
#include <strclass.h>
int main(void) {
String str;
str = "123";
str += '4';
str += "567";
return 0;
}
The compilation went OK. Then I opened a projekt file including only
the temp.cpp and tried to make an executable. Unfortunately it failed.
Creating: temp.exe
Error: temp.o: In function `main':
temp.cpp(1) Error: undefined reference to `String::String(void)'
temp.cpp(2) Error: undefined reference to `String::operator=(char const
*)'
temp.cpp(3) Error: undefined reference to `String::operator+=(char)'
temp.cpp(4) Error: undefined reference to `String::operator+=(char const
*)'
temp.cpp(5) Error: undefined reference to `String::~String(void)'
Error: temp.cpp(.text+0x8f): undefined reference to
`String::~String(void)'
There were some errors
I can't quite understand what was wrong, for the libgpp package seemed
installed OK, and djgpp.env was OK, too. I let RHIDE generate a
makefile. Hope someone can help me.
Thx,
Henry
# This file is automatically generated by RHIDE Version 1.4
# created from within RHIDE
RHIDE_GCC=gcc
RHIDE_AS=gcc
RHIDE_GXX=gcc
RHIDE_GPC=gpc
RHIDE_AR=ar
RHIDE_LD=gcc
RHIDE_G77=g77
RHIDE_NASM=nasm
RHIDE_LD_PASCAL=gpc
RHIDE_GNATBIND=gnatbind
RHIDE_RM=rm
RHIDE_ARFLAGS=rcs
RHIDE_TYPED_LIBS.f=m f2c
RHIDE_TYPED_LIBS.for=$(RHIDE_TYPED_LIBS.f)
RHIDE_TYPED_LIBS.F=$(RHIDE_TYPED_LIBS.f)
RHIDE_TYPED_LIBS.fpp=$(RHIDE_TYPED_LIBS.f)
RHIDE_TYPED_LIBS.p=m gpc
RHIDE_TYPED_LIBS.pas=$(RHIDE_TYPED_LIBS.p)
RHIDE_TYPED_LIBS_DJGPP.cc=stdcx
RHIDE_TYPED_LIBS_Linux.cc=stdc++
RHIDE_TYPED_LIBS.cc=$(RHIDE_TYPED_LIBS_$(RHIDE_OS).cc)
RHIDE_TYPED_LIBS.cpp=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.cxx=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.C=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.ii=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.l=fl
RHIDE_TYPED_LIBS.m=objc
RHIDE_TYPED_LIBS.adb=gnat
RHIDE_TYPED_LIBS=$(foreach suff,$(sort $(suffix\
$(PROJECT_ITEMS))),$(RHIDE_TYPED_LIBS$(suff)))
RHIDE_INCLUDES=$(SPECIAL_CFLAGS) $(addprefix -I,$(INCLUDE_DIRS))
RHIDE_LIBDIRS=$(addprefix -L,$(LIB_DIRS))
RHIDE_LIBS=$(addprefix -l,$(LIBS) $(RHIDE_TYPED_LIBS) $(RHIDE_OS_LIBS))
RHIDE_LDFLAGS=$(SPECIAL_LDFLAGS) $(addprefix -Xlinker
,$(LD_EXTRA_FLAGS))
RHIDE_NASM_TARGET_DJGPP=coff
RHIDE_NASM_TARGET_Linux=elf
RHIDE_NASM_TARGET=$(RHIDE_NASM_TARGET_$(RHIDE_OS))
RHIDE_COMPILE_NASM=$(RHIDE_NASM) -f $(RHIDE_NASM_TARGET) $(LOCAL_OPT)
-o\
$(OUTFILE) $(SOURCE_NAME)
RHIDE_COMPILE_FORTRAN=$(RHIDE_G77) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_F_LANG_FLAGS)
$(C_EXTRA_FLAGS)\
$(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_FORTRAN_FORCE=$(RHIDE_G77) $(RHIDE_INCLUDES)
$(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_F_LANG_FLAGS)
$(C_EXTRA_FLAGS)\
-x f77 $(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_C=$(RHIDE_GCC) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)
$(C_EXTRA_FLAGS)\
$(LOCAL_OPT) $(CPPFLAGS) $(CFLAGS) $(RHIDE_OS_CFLAGS) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_C_FORCE=$(RHIDE_GCC) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)
$(C_EXTRA_FLAGS)\
-x c $(LOCAL_OPT) $(CPPFLAGS) $(CFLAGS) $(RHIDE_OS_CFLAGS) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_CC=$(RHIDE_GXX) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)\
$(C_CXX_LANG_FLAGS) $(C_EXTRA_FLAGS) $(CPPFLAGS) $(CXXFLAGS)\
$(RHIDE_OS_CXXFLAGS) $(LOCAL_OPT) -c $(SOURCE_NAME) -o
$(OUTFILE)
RHIDE_COMPILE_CC_FORCE=$(RHIDE_GXX) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)\
$(C_CXX_LANG_FLAGS) $(C_EXTRA_FLAGS) $(CPPFLAGS) $(CXXFLAGS)\
$(RHIDE_OS_CXXFLAGS) -x c++ $(LOCAL_OPT) -c $(SOURCE_NAME) -o\
$(OUTFILE)
RHIDE_COMPILE_ASM=$(RHIDE_AS) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_EXTRA_FLAGS) $(LOCAL_OPT)
-c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_ASM_FORCE=$(RHIDE_AS) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_EXTRA_FLAGS) -x assembler\
$(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_GPC_FLAGS=$(RHIDE_INCLUDES) $(C_DEBUG_FLAGS) $(C_OPT_FLAGS)\
$(C_WARN_FLAGS) $(C_P_LANG_FLAGS) $(C_EXTRA_FLAGS)
RHIDE_COMPILE_PASCAL=$(RHIDE_GPC) $(RHIDE_GPC_FLAGS) $(LOCAL_OPT) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_PASCAL_FORCE=$(RHIDE_GPC) $(RHIDE_GPC_FLAGS) -x pascal\
$(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_LINK=$(RHIDE_LD) $(RHIDE_LIBDIRS) $(C_EXTRA_FLAGS)\
$(RHIDE_LDFLAGS) -o $(OUTFILE) $(LDFLAGS) $(OBJFILES)
$(LIBRARIES)\
$(RHIDE_LIBS)
RHIDE_COMPILE_LINK_PASCAL=$(RHIDE_LD_PASCAL) $(RHIDE_LIBDIRS)\
$(C_EXTRA_FLAGS) $(RHIDE_LDFLAGS) -o $(OUTFILE) $(LDFLAGS)\
$(OBJFILES) $(LIBRARIES) $(RHIDE_LIBS)
RHIDE_COMPILE_LINK_PASCAL_AUTOMAKE=$(RHIDE_LD_PASCAL) $(RHIDE_LIBDIRS)\
$(RHIDE_LDFLAGS) -o $(OUTFILE) --automake="$(strip\
$(RHIDE_GPC_FLAGS))" $(RHIDE_GPC_FLAGS) $(SOURCE_NAME)
$(LDFLAGS)\
$(LIBRARIES) $(RHIDE_LIBS)
RHIDE_COMPILE_ARCHIVE=$(RHIDE_AR) $(RHIDE_ARFLAGS) $(OUTFILE)
$(OBJFILES)
RHIDE_COMPILE_ADA=$(RHIDE_GCC) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)
$(C_EXTRA_FLAGS)\
$(LOCAL_OPT) $(C_ADA_LANG_FLAGS) $(CPPFLAGS) $(CFLAGS)\
$(RHIDE_OS_CFLAGS) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_ADA_BIND_FILE=$(addprefix _,$(setsuffix .c,$(OUTFILE)))
RHIDE_COMPILE_LINK_ADA_BIND=$(RHIDE_GNATBIND) -o $(RHIDE_ADA_BIND_FILE)\
$(setsuffix .ali,$(OUTFILE))
RHIDE_COMPILE_LINK_ADA_LINK=$(RHIDE_LD) $(RHIDE_LIBDIRS)
$(C_EXTRA_FLAGS)\
$(RHIDE_LDFLAGS) -o $(OUTFILE) $(LDFLAGS)
$(RHIDE_ADA_BIND_FILE)\
$(OBJFILES) $(LIBRARIES) $(RHIDE_LIBS)
_RHIDE_COMPILE_LINK_ADA=$(RHIDE_COMPILE_LINK_ADA_BIND);\
$(RHIDE_COMPILE_LINK_ADA_LINK); $(RHIDE_RM)\
$(RHIDE_ADA_BIND_FILE)
RHIDE_COMPILE_LINK_ADA=gnatbl $(RHIDE_LIBDIRS) $(C_EXTRA_FLAGS)\
$(RHIDE_LDFLAGS) -o $(OUTFILE) $(LDFLAGS) $(setsuffix\
.ali,$(OUTFILE)) $(LIBRARIES) $(RHIDE_LIBS)
RHIDE_COMPILE.c.o=$(RHIDE_COMPILE_C)
RHIDE_COMPILE.cc.o=$(RHIDE_COMPILE_CC)
RHIDE_COMPILE.p.o=$(RHIDE_COMPILE_PASCAL)
RHIDE_COMPILE.f.o=$(RHIDE_COMPILE_FORTRAN)
RHIDE_COMPILE.nsm.o=$(RHIDE_COMPILE_NASM)
RHIDE_COMPILE.s.o=$(RHIDE_COMPILE_ASM)
RHIDE_COMPILE.c.s=$(subst -c,-S,$(RHIDE_COMPILE_C))
RHIDE_COMPILE.c.i=$(subst -c,-E,$(RHIDE_COMPILE_C))
RHIDE_COMPILE.i.s=$(RHIDE_COMPILE.c.s)
RHIDE_COMPILE.cc.s=$(subst -c,-S,$(RHIDE_COMPILE_CC))
RHIDE_COMPILE.cc.ii=$(subst -c,-E,$(RHIDE_COMPILE_CC))
RHIDE_COMPILE.ii.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.cpp.o=$(RHIDE_COMPILE.cc.o)
RHIDE_COMPILE.cxx.o=$(RHIDE_COMPILE.cc.o)
RHIDE_COMPILE.C.o=$(RHIDE_COMPILE.cc.o)
RHIDE_COMPILE.pas.o=$(RHIDE_COMPILE.p.o)
RHIDE_COMPILE.for.o=$(RHIDE_COMPILE.f.o)
RHIDE_COMPILE.F.o=$(RHIDE_COMPILE.f.o)
RHIDE_COMPILE.fpp.o=$(RHIDE_COMPILE.f.o)
RHIDE_COMPILE.asm.o=$(RHIDE_COMPILE.nsm.o)
RHIDE_COMPILE.cpp.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.cxx.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.C.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.cpp.ii=$(RHIDE_COMPILE.cc.ii)
RHIDE_COMPILE.cxx.ii=$(RHIDE_COMPILE.cc.ii)
RHIDE_COMPILE.C.ii=$(RHIDE_COMPILE.cc.ii)
RHIDE_COMPILE.adb.o=$(RHIDE_COMPILE_ADA)
RHIDE_FSDB=fsdb $(OUTFILE) $(addprefix -p ,$(SRC_DIRS)) $(PROG_ARGS)
RHIDE_GDB=gdb $(OUTFILE) $(addprefix -d ,$(SRC_DIRS))
RHIDE_GREP=grep -n $(prompt arguments for GREP,$(WUC))
RHIDE_GPROF=gprof $(OUTFILE)
RHIDE_RLOG=$(shell rlog -R $(rlog_arg))
RHIDE_CO=$(shell co -q $(co_arg))
RHIDE_STANDARD_INCLUDES_DJGPP=$(addprefix $(DJDIR)/,include include/sys\
lang/cxx lang/cxx/std)
RHIDE_STANDARD_INCLUDES_Linux=$(addprefix /usr/,include include/sys\
include/g++ include/g++/std)
RHIDE_STANDARD_INCLUDES=$(RHIDE_STANDARD_INCLUDES_$(RHIDE_OS))
RHIDE_CONFIG_DIRS_DJGPP=. $(RHIDE_SHARE) $(HOME) $(DJDIR)/share/rhide
RHIDE_CONFIG_DIRS_Linux=. $(RHIDE_SHARE) $(HOME) /usr/local/share/rhide\
/usr/share/rhide
RHIDE_CONFIG_DIRS=$(RHIDE_CONFIG_DIRS_$(RHIDE_OS))
INCLUDE_DIRS=
LIB_DIRS=
C_DEBUG_FLAGS=-g
C_OPT_FLAGS=
C_WARN_FLAGS=-pedantic -w
C_C_LANG_FLAGS=
C_CXX_LANG_FLAGS=
C_P_LANG_FLAGS=
C_F_LANG_FLAGS=
C_ADA_LANG_FLAGS=
LIBS=
LD_EXTRA_FLAGS=
C_EXTRA_FLAGS=
LOCAL_OPT=$(subst ___~~~___, ,$(subst $(notdir $<)___,,$(filter
$(notdir\
$<)___%,$(LOCAL_OPTIONS))))
OBJFILES=temp.o
LIBRARIES=
SOURCE_NAME=$<
OUTFILE=$@
SPECIAL_CFLAGS=
SPECIAL_LDFLAGS=
PROG_ARGS=
SRC_DIRS=
WUC=
EDITORS=
RHIDE_OS=$(RHIDE_OS_)
ifeq ($(strip $(RHIDE_OS)),)
ifneq ($(strip $(DJDIR)),)
RHIDE_OS_:=DJGPP
else
RHIDE_OS_:=$(shell uname)
endif
endif
MAIN_TARGET=temp.exe
PROJECT_ITEMS=temp.cpp
%.o: %.c
$(RHIDE_COMPILE.c.o)
%.o: %.i
$(RHIDE_COMPILE_C)
%.o: %.cc
$(RHIDE_COMPILE.cc.o)
%.o: %.cpp
$(RHIDE_COMPILE.cpp.o)
%.o: %.cxx
$(RHIDE_COMPILE.cxx.o)
%.o: %.C
$(RHIDE_COMPILE.C.o)
%.o: %.ii
$(RHIDE_COMPILE_CC)
%.o: %.s
$(RHIDE_COMPILE.s.o)
%.o: %.S
$(RHIDE_COMPILE_ASM)
%.s: %.c
$(RHIDE_COMPILE.c.s)
%.s: %.i
$(RHIDE_COMPILE.i.s)
%.s: %.cc
$(RHIDE_COMPILE.cc.s)
%.s: %.cpp
$(RHIDE_COMPILE.cpp.s)
%.s: %.cxx
$(RHIDE_COMPILE.cxx.s)
%.s: %.C
$(RHIDE_COMPILE.C.s)
%.o: %.pas
$(RHIDE_COMPILE.pas.o)
%.o: %.p
$(RHIDE_COMPILE.p.o)
%.o: %.m
$(RHIDE_COMPILE_OBJC)
%.o: %.f
$(RHIDE_COMPILE.f.o)
%.o: %.for
$(RHIDE_COMPILE.for.o)
%.o: %.F
$(RHIDE_COMPILE.F.o)
%.o: %.fpp
$(RHIDE_COMPILE.fpp.o)
%.o: %.asm
$(RHIDE_COMPILE.asm.o)
%.o: %.nsm
$(RHIDE_COMPILE.nsm.o)
%.o: %.adb
$(RHIDE_COMPILE.adb.o)
all:: temp.exe
DEPS_0=\
d:/djgpp/user/temp.o
NO_LINK=
LINK_FILES=$(filter-out $(NO_LINK),$(DEPS_0))
temp.exe:: $(DEPS_0)
$(RHIDE_COMPILE_LINK)
DEPS_1=temp.cpp
temp.o:: $(DEPS_1)
$(RHIDE_COMPILE.cpp.o)
force::
--
* so @->-- do you want to go anywhere today? *
Henry 'Pi' James <henrypijames AT mailcity DOT com>
- Raw text -