From: codaditasso@tiscali.it
To: gcc-help@gcc.gnu.org
Subject: missing function
Date: Sun, 23 Nov 2003 15:22:00 -0000 [thread overview]
Message-ID: <3FAA85C800021D80@mail-7.tiscali.it> (raw)
Hello
I have write the following files:
prova91.cpp:
1 #include "prova92.h"
2
3 int
4 main(){
5 int k=1;
6 prova(k);
7 return 0;
8 };
prova92.h:
1 template <class T> void prova(T k);
prova92.cpp:
1 #include <iostream>
2 #include "prova92.h"
3 using namespace std;
4 template <class T> void
5 prova(T k){
6 cout<<k<<"\n";
7 };
And the i have digit the following command to compile the program:
bash-2.05b# g++ -c prova91.cpp
bash-2.05b# g++ -c prova92.cpp
bash-2.05b# g++ -o prova9 prova91.o prova92.o
But i have obtained the following error from the last command:
prova91.o(.text+0x1e): In function `main':
: undefined reference to `void prova<int>(int)'
collect2: ld returned 1 exit status
What's the problem ? Maybe the template function and class must be written
only in the header files?
Greetings from Pinzi
__________________________________________________________________
Tiscali ADSL SENZA CANONE, paghi solo quando navighi!
E in più il modem e' GRATIS! Abbonati subito.
http://point.tiscali.it/adsl/index.shtml
next reply other threads:[~2003-11-23 15:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-23 15:22 codaditasso [this message]
2003-11-23 22:06 Dara Hazeghi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FAA85C800021D80@mail-7.tiscali.it \
--to=codaditasso@tiscali.it \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).