public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15407] New: Problem using shared library created from template class
@ 2004-05-13 11:26 uttamkumar at hotmail dot com
2004-05-13 11:33 ` [Bug c++/15407] " uttamkumar at hotmail dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: uttamkumar at hotmail dot com @ 2004-05-13 11:26 UTC (permalink / raw)
To: gcc-bugs
I have a template class declare in T.hpp and defined in T.cpp and want to build
a shared library and use that library to write an application. Only application
knows about the template(object) type.
g++ -g -D_REENTRANT -frepo -O -W -Wall -Wno-unknown-pragmas -I. -I../h -fPIC -
c T.cpp
It has created the T.rpo repository file.
g++ -frepo -shared -o ../lib/libT.so -fPIC T.o
Now build the app Th.
g++ -g -D_REENTRANT -frepo -O -W -Wall -Wno-unknown-pragmas -I. -I../h -fPIC -
c Th.cpp
It has created the Th.rpo file too.
Now linking: and get the following errro.
g++ Th.o -o Th -L../lib -lT -lpthread -lnsl -lsocket -lstdc++ -l c -l gcc_s
Undefined first referenced
symbol in file
ThreadQueue<Msg>::GetMsg(long) Th.o
ThreadQueue<Msg>::CreateThread(void* (*)(void*), void*)Th.o
ThreadQueue<Msg>::PutMsg(Msg*) Th.o
ThreadQueue<Msg>::ThreadQueue[in-charge](int)Th.o
ld: fatal: Symbol referencing errors. No output written to Th
collect2: ld returned 1 exit status
--------------------------------------------------
If I use collect2 for linking I get the follwoing error.
collect2 Th.o -o Th -L../lib -l T -lpthread -lnsl -lsocket -lstdc++ -lc -
lgcc_s
collect: recompiling Th.cpp
collect: recompiling T.cpp
ThreadQueue.cpp: In member function `T* ThreadQueue<T>::GetMsg(long int)':
ThreadQueue.cpp:53: warning: `std::vector<T*, std::allocator<T*> >::iterator'
is implicitly a typename
ThreadQueue.cpp:53: warning: implicit typename is deprecated, please see the
documentation for details
collect: recompiling Th.cpp
collect: recompiling ThreadQueue.cpp
and it goes to infinite recompiling loop.
--
Summary: Problem using shared library created from template class
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uttamkumar at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] Problem using shared library created from template class
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
@ 2004-05-13 11:33 ` uttamkumar at hotmail dot com
2004-05-17 19:19 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: uttamkumar at hotmail dot com @ 2004-05-13 11:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uttamkumar at hotmail dot com 2004-05-12 19:43 -------
(In reply to comment #0)
> I have a template class declare in T.hpp and defined in T.cpp and want to
build
> a shared library and use that library to write an application. Only
application
> knows about the template(object) type.
> g++ -g -D_REENTRANT -frepo -O -W -Wall -Wno-unknown-pragmas -I. -I../h -
fPIC -
> c T.cpp
> It has created the T.rpo repository file.
> g++ -frepo -shared -o ../lib/libT.so -fPIC T.o
> Now build the app Th.
> g++ -g -D_REENTRANT -frepo -O -W -Wall -Wno-unknown-pragmas -I. -I../h -
fPIC -
> c Th.cpp
> It has created the Th.rpo file too.
> Now linking: and get the following errro.
> g++ Th.o -o Th -L../lib -lT -lpthread -lnsl -lsocket -lstdc++ -l c -l gcc_s
> Undefined first referenced
> symbol in file
> ThreadQueue<Msg>::GetMsg(long) Th.o
> ThreadQueue<Msg>::CreateThread(void* (*)(void*), void*)Th.o
> ThreadQueue<Msg>::PutMsg(Msg*) Th.o
> ThreadQueue<Msg>::ThreadQueue[in-charge](int)Th.o
> ld: fatal: Symbol referencing errors. No output written to Th
> collect2: ld returned 1 exit status
> --------------------------------------------------
> If I use collect2 for linking I get the follwoing error.
> collect2 Th.o -o Th -L../lib -l T -lpthread -lnsl -lsocket -lstdc++ -lc -
> lgcc_s
> collect: recompiling Th.cpp
> collect: recompiling T.cpp
> T.cpp: In member function `T* ThreadQueue<T>::GetMsg(long int)':
> T.cpp:53: warning: `std::vector<T*, std::allocator<T*> >::iterator'
> is implicitly a typename
> T.cpp:53: warning: implicit typename is deprecated, please see the
> documentation for details
> collect: recompiling Th.cpp
> collect: recompiling ThreadQueue.cpp
> and it goes to infinite recompiling loop.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] Problem using shared library created from template class
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
2004-05-13 11:33 ` [Bug c++/15407] " uttamkumar at hotmail dot com
@ 2004-05-17 19:19 ` pinskia at gcc dot gnu dot org
2004-05-21 18:14 ` uttamkumar at hotmail dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 19:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-17 04:31 -------
Either this is a dup of bug 8991 or bug 11247. I am certaint this is not a different bug at
all.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] Problem using shared library created from template class
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
2004-05-13 11:33 ` [Bug c++/15407] " uttamkumar at hotmail dot com
2004-05-17 19:19 ` pinskia at gcc dot gnu dot org
@ 2004-05-21 18:14 ` uttamkumar at hotmail dot com
2004-06-15 20:20 ` [Bug c++/15407] -frepo goes into infinite loop bangerth at dealii dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: uttamkumar at hotmail dot com @ 2004-05-21 18:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uttamkumar at hotmail dot com 2004-05-20 17:45 -------
Created an attachment (id=6348)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6348&action=view)
Code with make file, that does not work.
Here I am attaching the sample code that does not work. It creats a library for
the template class and use that library to create a binary.
How to build?
make Tem
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] -frepo goes into infinite loop
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
` (2 preceding siblings ...)
2004-05-21 18:14 ` uttamkumar at hotmail dot com
@ 2004-06-15 20:20 ` bangerth at dealii dot org
2004-06-15 21:34 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-06-15 20:20 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|Problem using shared library|-frepo goes into infinite
|created from template class |loop
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] -frepo goes into infinite loop
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
` (3 preceding siblings ...)
2004-06-15 20:20 ` [Bug c++/15407] -frepo goes into infinite loop bangerth at dealii dot org
@ 2004-06-15 21:34 ` pinskia at gcc dot gnu dot org
2004-06-16 21:39 ` uttamkumar at hotmail dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-15 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-15 21:34 -------
This is a dup of bug 8991.
*** This bug has been marked as a duplicate of 8991 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] -frepo goes into infinite loop
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
` (4 preceding siblings ...)
2004-06-15 21:34 ` pinskia at gcc dot gnu dot org
@ 2004-06-16 21:39 ` uttamkumar at hotmail dot com
2004-06-28 15:37 ` nferguso at eso dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: uttamkumar at hotmail dot com @ 2004-06-16 21:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uttamkumar at hotmail dot com 2004-06-16 21:39 -------
Put the patch as suggested in bug # 8991. Now I have a linking issue.
Here is the error.
make Tem
g++ -Wall -ansi -ggdb3 -frepo -fPIC -c T.cpp
T.cpp: In function `int main(int, char**)':
T.cpp:10: warning: unused variable `uint32_t i'
T.cpp:10: warning: unused variable `uint32_t num'
g++ -Wall -ansi -ggdb3 -frepo -fPIC -c Def.cpp
g++ -Wall -ansi -ggdb3 -frepo -fPIC -c Msg.cpp
g++ -Wall -ansi -ggdb3 -frepo -fPIC -c Tem.cpp
Tem.cpp: In member function `T* ThreadQueue<T>::GetMsg(long int)':
Tem.cpp:35: warning: `std::vector<T*, std::allocator<T*> >::iterator' is
implicitly a typename
Tem.cpp:35: warning: implicit typename is deprecated, please see the
documentation for details
g++ -frepo -shared -o libTem.so Tem.o
g++ -ggdb3 -frepo -o Tem T.o Def.o Msg.o -L. -lTem
Undefined first referenced
symbol in file
ThreadQueue<Msg>::PutMsg(Msg*) T.o
ThreadQueue<Msg>::GetMsg(long) T.o
ThreadQueue<Msg>::ThreadQueue[in-charge](int)T.o
ld: fatal: Symbol referencing errors. No output written to Tem
collect2: ld returned 1 exit status
make: *** [Tem] Error 1
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] -frepo goes into infinite loop
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
` (5 preceding siblings ...)
2004-06-16 21:39 ` uttamkumar at hotmail dot com
@ 2004-06-28 15:37 ` nferguso at eso dot org
2004-06-28 18:12 ` uttamkumar at hotmail dot com
2004-09-27 4:23 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: nferguso at eso dot org @ 2004-06-28 15:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nferguso at eso dot org 2004-06-28 15:30 -------
If you're talking about the patch I put there (atomicity.diff), I should warn
you that:
- it's for GCC 3.2.1
- it was never intended for anything other than experimentation.
Please don't try to use it for anything that matters...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] -frepo goes into infinite loop
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
` (6 preceding siblings ...)
2004-06-28 15:37 ` nferguso at eso dot org
@ 2004-06-28 18:12 ` uttamkumar at hotmail dot com
2004-09-27 4:23 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: uttamkumar at hotmail dot com @ 2004-06-28 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uttamkumar at hotmail dot com 2004-06-28 17:48 -------
1.Version of my GCC is 3.2.2
2. As you said: "it was never intended for anything other than
experimentation".
I tried to do an experiement only. Even that did not work.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15407] -frepo goes into infinite loop
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
` (7 preceding siblings ...)
2004-06-28 18:12 ` uttamkumar at hotmail dot com
@ 2004-09-27 4:23 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-27 4:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-27 04:23 -------
This is fixed on the mainline by Mark's patch to do always unit-at-a-time for C++.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15407
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-09-27 4:23 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13 11:26 [Bug c++/15407] New: Problem using shared library created from template class uttamkumar at hotmail dot com
2004-05-13 11:33 ` [Bug c++/15407] " uttamkumar at hotmail dot com
2004-05-17 19:19 ` pinskia at gcc dot gnu dot org
2004-05-21 18:14 ` uttamkumar at hotmail dot com
2004-06-15 20:20 ` [Bug c++/15407] -frepo goes into infinite loop bangerth at dealii dot org
2004-06-15 21:34 ` pinskia at gcc dot gnu dot org
2004-06-16 21:39 ` uttamkumar at hotmail dot com
2004-06-28 15:37 ` nferguso at eso dot org
2004-06-28 18:12 ` uttamkumar at hotmail dot com
2004-09-27 4:23 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).