This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
4301:test: /sbin/loader: Warning: Can't find strong symbol for _XXXXX
- From: =?gb2312?q?tom=20jun?= <tomjun001 at yahoo dot com dot cn>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 4 Nov 2002 16:19:05 +0800 (CST)
- Subject: 4301:test: /sbin/loader: Warning: Can't find strong symbol for _XXXXX
Hi,
I encountered a trouble while I build my c++ code
with gcc.3.0.2 in Tru64 V4.
There had not gcc compiler in the alpha computer
before I installed it by using a
binary package gcc-3.0.2.setld.tar.Z downloaded from
ftp.thewrittenword.com.
My c++ code had been compiled and linked to a
progrm by gcc.2.95.3 in Solaris8
for intel. Now, when I compile the code in Tru64, some
warnings will appeare such
as following:
./obj/test.o: std::ostream::write(char const*, long):
weak symbol multiply defined
./obj/test.o: std::basic_ios<char,
std::char_traits<char> >::setstate std::_Ios_Iostate):
weak symbol multiply defined
......
Subsequently, while running the program, there will
also appear so many warning
such as following:
4301:test: /sbin/loader: Warning: Can't find strong
symbol for _ZTIt
4301:test: /sbin/loader: Warning: Can't find strong
symbol for _ZTSPKs
4301:test: /sbin/loader: Warning: Can't find strong
symbol for _ZTSPs
4301:test: /sbin/loader: Warning: Can't find strong
symbol for _ZTSs
4301:test: /sbin/loader: Warning: Can't find strong
symbol for _ZTIs
......
Finally, the correct result of progam is obtained.
I know that the first kind of warning may be cleaned
by add a compile flag
-fno-weak. But I fail to clear the second kind of
warning, and as we know,
it is the more important.
Any thoughts about?
Thanks,
Tomjun.
The following are the relational codes:
1, test.cpp
#include <iostream>
#include "sparseM.h"
#include <vector>
#include <utility>
int main(void)
{
dataT<int> one(1,1,9);
sparseM<dataT<int> > oneM(2,2);
oneM.addElement(one);
dataT<int> *temp=oneM.getElement(1,1);
if(temp==NULL)
cout<<"0"<<endl;
else
cout<<temp->element<<endl;
cout<<"This is a test program for fork"<<endl;
return 1;
}
2, sparseM.h
#ifndef __SPARSEM_H__
#define __SPARSEM_H__
#include <iostream.h>
#include <fstream.h>
#include <string>
#include <cassert>
using namespace std;
template <class Type>
class dataT{
...
};
template <class T>
class sparseM{
...
};
// the template class implemental code
#endif
3, Makefile
CC = alpha-dec-osf4.0d-g++
RES =
OBJ = test.o $(RES)
LIBS = -L/opt/TWWfsw/gcc302/lib -L/usr/lib
INCS = -I"/usr/opt/TWWfsw/gcc302/include/g++-v3"
-I/usr/include
BIN = test
CFLAGS = $(INCS) -fno-weak
.PHONY: all clean
all: test
clean:
rm -f $(OBJ)
$(BIN): $(OBJ)
$(CC) $(OBJ) -o "test" $(LIBS) $(CFLAGS)
test.o: test.cpp
$(CC) -c test.cpp -o test.o $(CFLAGS)
_________________________________________________________
Do You Yahoo!?
"是IT精英吗?小试牛刀获时尚大奖!"
http://cn.promo.yahoo.com/cgi-bin/udb/u