|
I am having a problem compiling a class I downloaded from CodeProject. The class compiles until I try to create a variable of that type, and then I get a linker for each function that I try to call with that variable (to begin with, just the constructor and destructor.) Here are the compiling errors that I am receiving:
error LNK2019: unresolved external symbol "public: __thiscall CMultiColumnComboBox::CMultiColumnComboBox(void)" (??0CMultiColumnComboBox@@QAE@XZ) referenced in function "public: __thiscall NewInvoice::NewInvoice(void)" (??0NewInvoice@@QAE@XZ)
error LNK2001: unresolved external symbol "public: virtual __thiscall CMultiColumnComboBox::~CMultiColumnComboBox(void)" (??1CMultiColumnComboBox@@UAE@XZ)
The class is the CMultiColumnComboBox class from http://www.codeproject.com/combobox/mccombobox.asp#xx169761xx[^] The directions say to include the file in the .cpp file, but then I cannot declare variables in my .h file, so I had to include the class in my .h file. Now I'm getting these linker errors. Can somebody please give me some suggestions? Thanks a bunch!!
|
|
|
|
|
Did u add the file in the project?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
yes, the files are included in the project. 
|
|
|
|
|
DougW48 wrote:
The directions say to include the file in the .cpp file, but then I cannot declare variables in my .h file...
Probably because the two .h files are in the wrong order. The #include <MultiColumnComboBox.h> statement should precede the inclusion of your dialog's .h file. Or, if your dialog declaration is going to be used in places other than by its definition, you'll need the #include <MultiColumnComboBox.h> statement in the dialog's .h file instead, before any reference to the CMultiColumnComboBox class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Found the problem, thank you very much! 
|
|
|
|
|
DougW48 wrote:
Found the problem...
So what was it?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
When I included the files, the visual studios put them in a separate virtual folder called "Solution Items" I moved them into the same area of my solution explorer as my other files, and it compiled without a hitch. Now if I could just figure out how to update the class to work in 2000/XP I'll be all set, but that's for a different post! Thanks a bunch for your help!
|
|
|
|
|
How would you go about attaching 'winnm.dll' to a project? I am just unable to get my head around linking the dll files then accessing them. Do i need to create a header file?
What will i then need to include in the header file? I need to create a simple keyboard which uses low level design to produce sound through the sound card.
Any help would be appreciated.
Cheers
Mav
|
|
|
|
|
If you are thinking winmm.dll , you do not directly link DLLs to a project, you link the import library for them with the project. Try adding winmm.lib to your list of Libraries to link with.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Delete FXP Files Now!]
|
|
|
|
|
Good Day,
Everytime i create or open a project, an error occur:
fatal error RC1015: cannot open include file 'afxres.h'.
I searched and found the problem in Microsoft site:
http://support.microsoft.com/default.aspx?scid=kb;ja;326987
but i could not read the file coz i dont have the OS installer
to support the language.
I already reinstall Visual Studio but the same things happen.
Thanks a lot.
spingkoy
|
|
|
|
|
The MSDN article Q156916 gives pretty detailed steps on how to fix it. Did you try compiling the .RC file into a .RES file?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I tried to search the article Q156916, it has been referred to Article - 156916.
The article talks about J++. I tried renaming the .rc to .rct or .res but when i load the
project and go on the resource tab, the same error appear.
spingkoy
|
|
|
|
|
spingkoy wrote:
I tried renaming the .rc to .rct or .res...
It has to be compiled, not renamed.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I've compiled it, but same things happen.
Im having a dual boot so I've tried re-installing
on the other OS and it works. I think its cause is
software conflict. I did know that my friend
installed Visual Studio on the other OS.
Thanks for the support.
Have a nice day and More Power to you.
spingkoy
|
|
|
|
|
Hi !
I'm facing a very strange problem with the code snippet below.
I'm creating a base class (JSBase) which provides two virtual methods. These two methods have the same name.
In a derived class, I reimplement only one of these two methods.
In the main(), I instanciate the derived class and call one of the method of the base class (the one which has not be reimplemented in the derived class).
When I compile, I get this error :
.\TestDerive.cpp(64) : error C2664: 'import' : cannot convert parameter 1 from '
class ClassTest1' to 'class ClassTest2'
No constructor could take the source type, or constructor overload resol
ution was ambiguous
What's wrong ? Can't I reimplement only one of the method in the derived class ?
I would appreciate a lot your help !
Thanks !
Jerome
class ClassTest1 {};
class ClassTest2 {};
class JSBase
{
public:
JSBase() {};
virtual ~JSBase() {};
virtual void import(ClassTest1 Data) {};
virtual void import(ClassTest2 Data) {};
};
class JSDerived : public JSBase
{
public:
JSDerived() : JSBase() {};
~JSDerived() {};
void import(ClassTest2 Data) {};
};
void main(int argc, char* argv[])
{
JSDerived MyDerived;
ClassTest1 MyData;
MyDerived.import(MyData);
}
|
|
|
|
|
you implemented void import(ClassTest2 Data) {};
but calling MyDerived.import(MyData); with MyData of type ClassTest1
See the prob?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi Papa !
Sure, I'm calling the 'import()' method with a parameter of type ClassTest1. The base class has such a method. Why is this method not accessible from the derived class ? This is what is strange for me !
Jerome
|
|
|
|
|
try to create a cast operator...
operator (ClassTest2)
TOXCCT >>> GEII power
|
|
|
|
|
Are you using vs6?
[EDIT]
I thought it was a bug with vc6 but it does the same in vc7 too.
One thing you can do is define void import(ClassTest1 Data) {};
and have it call the base:
void import(ClassTest1 Data) {
JSBase::import(Data);
};
[/EDIT]
John
|
|
|
|
|
Hi John !
Yes, I am....a bug with VS 6 ????
Jerome
|
|
|
|
|
Reread my previous post, I edited it while you were replying..
John
|
|
|
|
|
Hi John !
Thanks for your help !
The workaround you suggest is the one I implemented, but I'm not very satisfied : I'd like to understand why what I wanted to do is not allowed.....
Thanks again !
Jerome
|
|
|
|
|
Jerome Conus wrote:
The workaround you suggest is the one I implemented, but I'm not very satisfied
I thought of that and agree it does not make a lot of sense why that operation is not allowed.
John
|
|
|
|
|
Hi,
You have discovered a slight 'flaw' in C++. This isn't a VS6 thing. When overloading virtual functions in base classes, the member function in the derived class 'hides' the overloaded base class function. You will need to explicitly call the baseclass function:
MyDerived.JCBase::import(MyData);
to do what you want done. As a general rule, don't overload virtual functions, for the reason you found out.
-Mike
|
|
|
|
|
Hi
I have a question here. Let's say i have a program running as service, which is shown in the taskbar. If i dubbelclick the item in the taskbar, i get the screen of my application. If i quit the program, the item in the taskbar is gone (I handled message 'OnDestroy' of my application & deleted the item in taskbar).
If i stop the service in the service section of Computer Management. The item in the taskbar isn't deleted. Isn't message 'WM_DESTROY' send to my application .. i don't think so actually .. but which message is it, so i can delete the icon in the taskbar myself when needed. Same goes for Reboot service !
Greetings,
Jens
|
|
|
|