Click here to Skip to main content
16,004,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Prob with Bitmap Pin
Schehaider_Aymen9-Apr-08 5:48
Schehaider_Aymen9-Apr-08 5:48 
GeneralRe: Prob with Bitmap Pin
Mark Salsbery9-Apr-08 6:07
Mark Salsbery9-Apr-08 6:07 
GeneralRe: Prob with Bitmap Pin
Schehaider_Aymen9-Apr-08 6:13
Schehaider_Aymen9-Apr-08 6:13 
GeneralRe: Prob with Bitmap Pin
Mark Salsbery9-Apr-08 6:17
Mark Salsbery9-Apr-08 6:17 
GeneralRe: Prob with Bitmap Pin
Hamid_RT10-Apr-08 23:52
Hamid_RT10-Apr-08 23:52 
Questionhow to block IPv6 traffic on Win Xp Pin
Ather Zaidi9-Apr-08 5:13
Ather Zaidi9-Apr-08 5:13 
AnswerRe: how to block IPv6 traffic on Win Xp Pin
led mike9-Apr-08 5:51
led mike9-Apr-08 5:51 
GeneralLeaning C++, annoying compile/link error Pin
Jan Sommer9-Apr-08 5:03
Jan Sommer9-Apr-08 5:03 
I've managed to compile and run all the samples in the book so far, but all the sudden this code comes up and gives me nasty headaches.

When i'm trying to compile the code below everything goes fine until the compiler tries to link it.

Here's the error i get:
    cd /Users/summer/Documents/C++/xcodeproject/ex<br />
    /Developer/usr/bin/g++-4.0 -o /Users/summer/Documents/C++/xcodeproject/ex/build/Debug/ex -L/Users/summer/Documents/C++/xcodeproject/ex/build/Debug -F/Users/summer/Documents/C++/xcodeproject/ex/build/Debug -filelist /Users/summer/Documents/C++/xcodeproject/ex/build/ex.build/Debug/ex.build/Objects-normal/i386/ex.LinkFileList -arch i386 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk<br />
Undefined symbols:<br />
  "vtable for Kvadrat", referenced from:<br />
      __ZTV7Kvadrat$non_lazy_ptr in main.o<br />
ld: symbol(s) not found<br />
collect2: ld returned 1 exit status<br />
	  "vtable for Kvadrat", referenced from:<br />
	      __ZTV7Kvadrat$non_lazy_ptr in main.o<br />
	ld: symbol(s) not found<br />
	collect2: ld returned 1 exit status


And here's the code:
#include <iostream>
using namespace std;

class Form
{
public:
	Form() {}
	virtual ~Form() {}
	virtual long HentAreal() { return -1; }
	virtual long HentOmkreds() { return -1; }
	virtual void Tegn() {}
};

class Rektangel : public Form
{
public:
	Rektangel(int laengde, int bredde):
		densLaengde(laengde), densBredde(bredde) {}
	virtual ~Rektangel() {}
	virtual long HentAreal() { return densLaengde * densBredde; }
	virtual long HentOmkreds() { return 2*densLaengde + 2*densBredde; }
	virtual int HentLaengde() { return densLaengde; }
	virtual int HentBredde() { return densBredde; }
	virtual void Tegn();
private:
	int densBredde;
	int densLaengde;
};

void Rektangel::Tegn()
{
	for (int i = 0;i < densLaengde;i++)
	{
		for (int j = 0;j < densBredde;j++)
			cout << "x";
			
		cout << "\n";
	}
}

class Kvadrat : public Rektangel
{
public:
	Kvadrat(int laengde);
	Kvadrat(int laengde, int bredde);
	~Kvadrat();
	long HentOmkreds() { return 4 * HentLaengde(); }
};

Kvadrat::Kvadrat(int laengde):
	Rektangel(laengde, laengde)
{}

int main()
{
	cout << "Do stuff";
	return 0;
}</iostream>

When i remove
Kvadrat::Kvadrat(int laengde):<br />
	Rektangel(laengde, laengde)<br />
{}

It compiles without problems. But i want to create a rectangel upon creation of a square! (rektangel == rectangel && kvadrat == square in danish)
GeneralRe: Leaning C++, annoying compile/link error Pin
David Crow9-Apr-08 5:24
David Crow9-Apr-08 5:24 
GeneralRe: Leaning C++, annoying compile/link error Pin
Jan Sommer9-Apr-08 5:39
Jan Sommer9-Apr-08 5:39 
GeneralRe: Leaning C++, annoying compile/link error Pin
CPallini9-Apr-08 5:39
mveCPallini9-Apr-08 5:39 
GeneralRe: Leaning C++, annoying compile/link error Pin
Rajesh R Subramanian9-Apr-08 5:44
professionalRajesh R Subramanian9-Apr-08 5:44 
GeneralRe: Leaning C++, annoying compile/link error Pin
CPallini9-Apr-08 5:48
mveCPallini9-Apr-08 5:48 
GeneralMicrosoft Sam Pin
codeinelogic9-Apr-08 4:40
codeinelogic9-Apr-08 4:40 
QuestionRe: Microsoft Sam Pin
David Crow9-Apr-08 4:48
David Crow9-Apr-08 4:48 
GeneralPlease verify the function Pin
bibhakar9-Apr-08 2:53
bibhakar9-Apr-08 2:53 
GeneralRe: Please verify the function Pin
Iain Clarke, Warrior Programmer10-Apr-08 0:08
Iain Clarke, Warrior Programmer10-Apr-08 0:08 
GeneralBitmap not getting loaded Pin
sheetal_069-Apr-08 2:24
sheetal_069-Apr-08 2:24 
GeneralRe: Bitmap not getting loaded Pin
Sarath C9-Apr-08 4:01
Sarath C9-Apr-08 4:01 
GeneralRe: Bitmap not getting loaded Pin
sheetal_069-Apr-08 18:18
sheetal_069-Apr-08 18:18 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT11-Apr-08 0:23
Hamid_RT11-Apr-08 0:23 
GeneralRe: Bitmap not getting loaded Pin
sheetal_0613-Apr-08 18:47
sheetal_0613-Apr-08 18:47 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT13-Apr-08 19:45
Hamid_RT13-Apr-08 19:45 
GeneralRe: Bitmap not getting loaded Pin
sheetal_0613-Apr-08 20:06
sheetal_0613-Apr-08 20:06 
GeneralRe: Bitmap not getting loaded Pin
Hamid_RT14-Apr-08 21:42
Hamid_RT14-Apr-08 21:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.