Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » am ashamed to ask for help on this but...
am ashamed to ask for help on this but... [message #8469] Mon, 12 March 2007 22:13 Go to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
am scratching my head - its probably my poor knowledge of C++ but am sitting here with Jamsa's Bible and can't see what am doing wrong. Also, I've had my faith in the U++ IDE shaken a little since I realised there is "hidden" code that sometimes gets messed up and all you can do is delete your project and start again (e.g. I had to do this because an "empty" .iml file was in somehow corrupted. I deleted the project, copied all the code across and hey presto, my new imageclass worked just fine. I had used all the clean commands I could find but something is hidden)

Anyway, I get this error

Linking...
(option '-O 2' ignored)
___main: duplicate
-> used: libmingw32.a:gccmain.o:1
-> discarded: libgcc.a:__main.o:1
1 undefined symbol(s):
vtable for Layer(referenced from c:\upp\out\openwind\mingw.debug_full.gui.main.mt\layer.o:1; Layer::Layer(void); Layer::Layer(); Layer::Layer(void); Layer::Layer(); Layer::~Layer(void); Layer::~Layer(); ...)
linking aborted due to fatal errors
collect2: ld returned 1 exit status

There were errors. (0:12.45)




but I can't for the life of me see why. My header is as follows:-

############################################################ #
// contains layer base class plus image and raster classes and vector support

#ifndef __LAYER_H__
#define __LAYER_H__


#include <CtrlLib/CtrlLib.h>

using namespace Upp;





class Layer
{
public:
typedef Layer CLASSNAME;

Layer();
~Layer(void);

virtual void DrawLayer(Draw& w, void* pView);

// virtual void Read(String& path);

bool m_bVisible;
bool m_bSelected;
bool m_bIsValid;

Rect GetRect();

protected:
Rect m_rc; // maximum extent of this layer

String m_sPath;
String m_sFilename;


};

class ImageLayer : public Layer
{
public:
typedef ImageLayer CLASSNAME;

ImageLayer();
ImageLayer(String& path);
~ImageLayer();

Image m_img;

void Read(String& path);

void DrawLayer(Draw& w, void* pView);

protected:
int m_nRes;





};
#endif
############################################################ ##

and my cpp file just implements the functions in the simplest way imaginable. Please explain to me either the extent of my ignorance or the way in which it is possible to unconfuse the IDE if I am not at fault.

I am so ashamed Smile (and only posting here because of the previous voodoo with the .iml file)

Nick

edit: I split the two classes into two separate sets of files and I still get the same error although sometimes it says something like

; .text$_ZN5LayerD2Ev)

at the end. This looks like the strangeness I had with the .iml file and makes me believe that there is hidden information in the IDE which I do not have access to. I would be just pathetically grateful to anyone who can tell me what I am missing. I've tried renaming my classes, using implied constructors. I don't know what to do. There must be a way to tell the IDE to just scrap everything and start from the code I have as it is written - surely.


[Updated on: Mon, 12 March 2007 23:50]

Report message to a moderator

follow up question [message #8471 is a reply to message #8469] Tue, 13 March 2007 02:45 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
ok here's a thing - didn't change the code at all but sometimes I get the error above and other times I get this error

Linking...
(option '-O 2' ignored)
___main: duplicate
-> used: libmingw32.a:gccmain.o:1
-> discarded: libgcc.a:__main.o:1
1 undefined symbol(s):
vtable for Layer(referenced from c:\upp\out\openwind\mingw.debug_full.gui.main.mt\$blitz.o:1; CUtils::CUtils(void); CUtils::CUtils(); CUti
ls::CUtils(void); CUtils::CUtils(); CUtils::~CUtils(void); CUtils::~CUtils(); ...)
linking aborted due to fatal errors
collect2: ld returned 1 exit status

There were errors. (1:00.15)

Its utterly bizarre

Why does it ask for the same thing over and over again please?


[Updated on: Tue, 13 March 2007 02:46]

Report message to a moderator

Re: follow up question [message #8472 is a reply to message #8471] Tue, 13 March 2007 03:27 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
ok I tried deleting the directory and making a new package and then copying across the source files.

UPP truncated one of my files and now it compiles without throwing errors even though am missing functions and then it links and doesnt complain about the missing functions but instead about constructors which aren't even ever called.

I give up - if someone can please help me, just a clue would be great - been on this for over 24 hours and its just getting stranger.
Re: follow up question [message #8475 is a reply to message #8472] Tue, 13 March 2007 11:05 Go to previous messageGo to next message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
Could you please post your package then I can have a look at it.

Something important in C++: use virtual destructor when using inheritance (to ensure that the right destructor get called)
Re: am ashamed to ask for help on this but... [message #8480 is a reply to message #8469] Tue, 13 March 2007 14:43 Go to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Thanks so much Victorb. It was exactly what you said. I should have looked more closely at my code but the .iml thing had got me spooked.

Oh man! I was being a real dumbass. If any admins are reading this please feel free to delete this thread. "promising member" indeed - "promising pain in the hole" more like Laughing
Previous Topic: HttpClient example with Post data
Next Topic: setting the cursor
Goto Forum:
  


Current Time: Sat Apr 20 03:53:12 CEST 2024

Total time taken to generate the page: 0.06111 seconds