From: "Philippe De Neve" <Philippe.deneve@intec.ugent.be>
To: linux-newbie@vger.kernel.org
Subject: undefined reference to...
Date: Fri, 20 Aug 2004 16:47:43 +0200 [thread overview]
Message-ID: <001301c486c4$a625bea0$bb7ac19d@King> (raw)
Hi,
I'm new to programming and I'm having a problem I don't understand:
I have 3 very simple files:
1) Integerclass.h containing :
class Integer{
int i;
public:
Integer(int j){
i=j;
}
void change(void);
};
2) Integerclass.cpp containing :
#include "Integerclass.h"
void Integer::change(void){
i=5;
}
3) my_prog.cpp containing
#include "Integerclass.h"
int main(){
Integer P(2);
P.change();
return 0;
};
When I compile the Integerclass.cpp file no errors are returned.
But when I compile and link this :
c++ -o my_prog my_prog.cpp
the output is :
demovideo3:/Projects/little_proggie# c++ -o my_prog my_prog.cpp
/tmp/ccsGvVWq.o: In function `main':
/tmp/ccsGvVWq.o(.text+0x1f): undefined reference to `Integer::change(void)'
collect2: ld returned 1 exit status
demovideo3:/Projects/little_proggie#
I do not understand where I'm making a mistake. I did the same on a windows
machine using VC++ and no errors where returned? Can anyone explain me what
I'm doing wrong? Any help is appreciated!
regards, Philippe.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next reply other threads:[~2004-08-20 14:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 14:47 Philippe De Neve [this message]
2004-08-20 17:32 ` undefined reference to Steven Smith
2004-08-20 17:47 ` Ray Olszewski
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='001301c486c4$a625bea0$bb7ac19d@King' \
--to=philippe.deneve@intec.ugent.be \
--cc=linux-newbie@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.