Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Need help with CRegKey!

hello there. i wanna use CRegKey provided in VC++ 5 to access Win95's registry, but while i compile my app i get an error: LNK2001: unresolved external symbol "public: long __thiscall ATL::CRegKey::Open(void)" (?Open@CRegKey@ATL@@QAEJXZ)

i already include "atlbase.h", but it seems VC can't find the implementation defined in "atlimpl.cpp". do i have to put this file into my project? or there's another solution?
please help...
0
darrelliu
Asked:
darrelliu
  • 6
  • 4
1 Solution
 
thresher_sharkCommented:
Are you including the right library (LIB file) too?
0
 
darrelliuAuthor Commented:
which one? ATL.LIB? i tried this but not working...
0
 
thresher_sharkCommented:
Wow this is really pathetic, there is no place in the documentation that tells you what library file to use.  But, from what meager information is in that header file, it would seem that atl.lib is the correct one.  I am not sure why it is not working.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
thresher_sharkCommented:
We can do this the hard way though... Copy the file atlimpl.cpp (located in the vc\atl\include directory) to the directory your project is in, and then include it.  That ought to fix it.
0
 
thresher_sharkCommented:
In fact, I am certain that will fix it.  Please take my above comment as an answer.

If you have any further questions, please feel free to ask.

Thanks!
0
 
thresher_sharkCommented:
Clarification:

I said:
>> and then include it.  That ought to fix it.

I meant to say:
>> and then add it to your project by going to the Project menu->Add to project->Files.  That ought to fix it.
0
 
darrelliuAuthor Commented:
yes, i even have tried to this. i copied 'atlimpl.cpp' into the 'myapp' directory and added it into my project, but when i compiled it, i got an error said:
error LNK2001: unresolved external symbol "public: long __thiscall ATL::CRegKey::Open(struct HKEY__ *,char const *,unsigned long)" (?Open@CRegKey@ATL@@QAEJPAUHKEY__@@PBDK@Z)
well there's only one, not like before there were 2, 'Open' and 'Close'. i think it's because there's no parameters needed for 'Close'. i don't know why, but compare with the definition, seems because a 'overloaded' 'Open' function can not be found (the original definition should be LONG Open(HKEY, LPCTSTR, REGSAM))...
anyway, thank your help!
0
 
thresher_sharkCommented:
Glad I could help.
0
 
darrelliuAuthor Commented:
wow! finally i got it! i modified 'atlbase.h' and 'atlimpl.cpp' and left only those CRegKey parts, then added to my project and it worked! i mean it now can go thru the compiling. so this class just has nothing to do with the ATL. thanx for the help!
0
 
darrelliuAuthor Commented:
and, don't forget to include "stdafx.h" in your modified 'atlimpl.cpp' or you'll get hundreds of errors!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now