|
Manjunath S wrote: But the problem is, the control (here static text) inside this dialog is not displaying...
Are there any other controls on the dialog that are not being displayed? If so, it sounds like a secondary thread is needed as the UI thread is too busy servicing other messages.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Errors:
Sentence error LNK2001: unresolved external symbol "protected: virtual int __thiscall CSentenceList::HowManyWords(char const *)" (?HowManyWords@CSentenceList@@MAEHPBD@Z)
Sentence error LNK2001: unresolved external symbol "protected: virtual void __thiscall CSentenceList::swapWithNext(void)" (?swapWithNext@CSentenceList@@MAEXXZ)
Sentence error LNK2001: unresolved external symbol "protected: virtual void __thiscall CSentenceList::storeSentence(char const *)" (?storeSentence@CSentenceList@@MAEXPBD@Z)
Sentence error LNK2019: unresolved external symbol "public: __thiscall CSentenceArray::CSentenceArray(bool)" (??0CSentenceArray@@QAE@_N@Z) referenced in function "public: __thiscall CSentenceList::CSentenceList(bool)" (??0CSentenceList@@QAE@_N@Z)
Sentence error LNK2019: unresolved external symbol "public: virtual __thiscall CSentenceArray::~CSentenceArray(void)" (??1CSentenceArray@@UAE@XZ) referenced in function "public: virtual __thiscall CSentenceList::~CSentenceList(void)" (??1CSentenceList@@UAE@XZ)
SentenceAr.h
#pragma once
#include <ostream>
using namespace std;
class CSentenceArray
// Sentences stored as an array
{ public:
CSentenceArray(bool bCreateArray);
virtual ~CSentenceArray(void);
void readFromFile (const char *pszFileName);
//void Display (ostream &Sentence);
void sortSentences(bool bAscending); // implements BubbleSort or quicksort
void Clear();
int FirstWord(const char *ptrWord);
int HowManyWords(const char *pszWord);
protected:
//virtual void storeSentence(const char *pszSentence);
//virtual const char *getNextSentence();
//virtual const char *peekNextSentence();
//virtual void swapWithNext();
//virtual void Reset();
//virtual void eraseAll();
private:
char *m_pSentences;
int m_iCurrentPos;
};
SentenceAr.cpp
#include "StdAfx.h"
#include ".\SentenceAr.h"
void CSentenceArray::sortSentences(bool bAscending) // implements BubbleSort or quicksort
{ int x = NULL;
}
void CSentenceArray::Clear()
{}
int CSentenceArray::FirstWord(const char *ptrWord)
{ return 0;}
int CSentenceArray::HowManyWords(const char *pszWord)
{ return 0;}
Jon
|
|
|
|
|
Did you saw MSDN for LNK2001
From the MSDN:
"unresolved external symbol "symbol"
Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files."
whitesky
|
|
|
|
|
Add your cpp file to your solutions explorer (I'm assuming you're using VS7.1), or File View (if using VS 6.0).
This tells the compiler where to find the implementation of the class definitions.
I Dream of Absolute Zero
|
|
|
|
|
CSentenceArray is not the same thing as CSentenceList .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How to hide (or not to create) the menu of an SDI project generated by the wizard code of VC++ 2005? Thanks!
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: How to hide (or not to create) the menu of an SDI project
I figured it out.
1) To hide the menu, according to the source code of CDocTemplate, we have to do this way:
pDocTemplate = new CSingleDocTemplate(
0,
RUNTIME_CLASS(CTextEditorDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CTextEditorView));
2) Then we will see the icon of the application not being loaded. We have to load it in CMainFrame::OnCreate.
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
Maxwell Chen
|
|
|
|
|
If you don't want the wizard created Menu at any time in your application then simply remove the IDR_MAINFRAME menu resource from your application. If you want to use it in some time then change the ID of the menu from IRD_MAINFRAME to some other
Do your Duty and Don't expect the Result
|
|
|
|
|
The compiler warns at the following
#include "StdAfx.h"
#include ".\sentencelist.h"
CSentenceList::CSentenceList(bool bCreateArray) : CSentenceArray(bCreateArray)
{ int x = NULL; //... this is where the compilation is interrupted
}
CSentenceList::~CSentenceList(void)
{
}
SentenceAr.h
#pragma once
#include <ostream>
using namespace std;
class CSentenceArray
// Sentences stored as an array
{ public:
CSentenceArray(bool bCreateArray);
virtual ~CSentenceArray(void);
void readFromFile (const char *pszFileName);
//void Display (ostream &Sentence);
void sortSentences(bool bAscending); // implements BubbleSort or quicksort
void Clear();
int FirstWord(const char *ptrWord);
int HowManyWords(const char *pszWord);
protected:
//virtual void storeSentence(const char *pszSentence);
//virtual const char *getNextSentence();
//virtual const char *peekNextSentence();
//virtual void swapWithNext();
//virtual void Reset();
//virtual void eraseAll();
private:
char *m_pSentences;
int m_iCurrentPos;
};
SentenceList.h
#pragma once
using namespace std;
#include "sentencear.h"
class CSentenceList :
// Sentences stored as a linked list
public CSentenceArray
{
public:
CSentenceList(bool bCreateArray);
virtual ~CSentenceList();
void deleteWord( const char *pszWord);
void printMaxSentences (ostream &out);
protected:
void CSentenceArray(bool bCreateArray);
virtual void storeSentence(const char *pszSentence);
virtual void swapWithNext();
virtual int HowManyWords(const char *pszWord);
};
Jon
|
|
|
|
|
there's no default constructor defined in your class. you should pass the bool value to the CSentenceArray class.
i.e the implementation code of CSentenceList constructor, you should pass teh bool value to as initialization list
CSentenceList::CSentenceList(bool bCreateArray) : CSentenceArray(bCreateArray)
{
}
hope it's clear
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Patte
-- modified at 11:28 Sunday 16th July, 2006
|
|
|
|
|
I think that's what I'm doing actually...
#include "StdAfx.h"
#include ".\sentencelist.h"
CSentenceList::CSentenceList(bool bCreateArray) : CSentenceArray(bCreateArray)
{//Code}
CSentenceList::~CSentenceList ()
{}
Error:
error C2512: 'CSentenceArray' : no appropriate default constructor available
error C2436: 'CSentenceArray' : member function or nested class in constructor initializer list
Jon
|
|
|
|
|
Make sure you have the equivalent of a default destructor by giving the parameters of your constructor default values. "C++ will not attempt to create a default constructor for you if you declare one" (Effective C++ Third Edition - Scott Meyers)
Try this in your declaration in the header file...
CSentenceList(bool bCreateArray=false);
|
|
|
|
|
I tried adding a default value, even in the base class, but it's still unsuccessful.
CSentenceList::CSentenceList(bool bCreateArray = false) : CSentenceArray(bCreateArray = false)
{int x = NULL;}
CSentenceList::~CSentenceList ()
{}
Jon
|
|
|
|
|
No, your putting it in the implementation section.
Put it only in the declaration in the header file.
|
|
|
|
|
jon_80 wrote:
I think that's what I'm doing actually...
Not per the code you've shown. The compiler is telling you exactly what the problem is. CSentenceArray has no default constructor.
class CSentenceArray
{
public:
CSentenceArray( void );
};
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You have declared a function called CSentenceArray in the CSentenceList class. I suspect this is hiding the CSentenceArray class constructor. Remove or rename this function, I'm pretty sure this is illegal anyway and you're just getting a poor diagnostic message from the compiler.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thats just passing the parameter to the base class which is correct, otherwise the base class will not get any parameters to initialize with. The class declaration shows CSentenceList is derived from CSentenceArray...
class CSentenceList :
// Sentences stored as a linked list
public CSentenceArray
-- modified at 12:57 Sunday 16th July, 2006
Oh crud, I just spotted what you were talking about. I missed that the first time around. You are right. That doesn't look quite right...
protected:
void CSentenceArray(bool bCreateArray);
virtual void storeSentence(const char *pszSentence);
virtual void swapWithNext();
virtual int HowManyWords(const char *pszWord);
};
-- modified at 13:01 Sunday 16th July, 2006
|
|
|
|
|
Hi everybody,
My question is how to convert this c++ code to javascript or html that can generate the result random number?
#include <cstdlib>
#include <ctime>
#include <iostream>
using std::cout;
int main( ) {
srand( ( unsigned )time( 0 ) );
int randomKey = rand() % 4013;
cout << "Your random key is: " << ( 10016486 + ( randomKey * 22423 ) ) << "\n";
system( "PAUSE" );
return 0;
}
Thanks for any help
|
|
|
|
|
Googling "javascript random" yields this[^] as the first result...
|
|
|
|
|
Hi,
i have developed COM componet,its a custom Component,it supports ConnectionPoints,the Conntection interface is dervied from IUnknown.In the Client Side i have imported tlb file,I have wrote class CSink:_ISampleEvents
CSink psink;
psink = new CSink;
the following error is occuring
error C2259: : cannot instantiate abstract class
why..? how to avoid it,what could be the reason?
Thanks in before
james
|
|
|
|
|
CSink psink; //should be CSink* psink?
you'd better check the class CSink and make sure that
the CSink impliment all the virtual functions whose it's drivied from
hi
|
|
|
|
|
An abstract class is one that has one or more pure virtual functions defined. The intent is that you derive from that class and provide actual implementations for each of these functions. You can't instantiate a class that has a pure virtual function defined (since if you called it, the computer wouldn't knnow what to do) so the error message you're getting indicates that you've missed (at least) one.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
yeah i have overridden all the pure virtual function`s in the derived class,and wrote their implementation,even then i am getting error..
|
|
|
|
|
You have to check all the way up the hierarchy. Maybe you're deriving from a class that is derived from a class that is derived from a class that still has a pure virtual function
The error message is definitely caused by this (although vecodo_doon's comment may well be the cause as well).
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Have you implemented all of IUnknown 's methods?
If you're using ATL's support by deriving from CComObjectRoot(Ex), the class you declare is not complete - it still has some abstract methods. You have to make use of the CComObject family of templates (CComObject, CComAggObject, CComPolyObject, CComObjectStack) to actually create an instance. The ATL implementation of the class factory does this for you, depending on which DECLARE_AGGREGATABLE macro you used.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|