Compiler problem ( faster may be able to help)

Hi again
I am using BC4.52 and in my program am using the RegOpenKeyEx()  function. In fact I copied an example that
'faster' gave in an anwer to someone.
The other day when I compiled it, everything worked, but now I get this linker error.

Linking regread.exe:
Linker Error: Unresolved external 'RegOpenKeyExA(HKEY__*,const
char*,unsigned long,unsigned long,HKEY__**)' referenced from module
REGREAD.CPP

Does any-one know what it means AND how to solve it.
Regards
David Schmider

LVL 1
dschAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
Go to the your project settings and add advapi32.lib to the link option.
0
dschAuthor Commented:
How do I do that in the IDE?
0
dschAuthor Commented:
chensu, I do not have this file (advapi32.lib) on my computer anyway so how could it work before?
I have to re-open the question
Thanks anyway
David

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

chensuCommented:
I don't have the compiler you are using. But advapi32.lib should be there.
0
AlexVirochovskyCommented:
Test you project to Win32 Platform(not Win3x(16)!)
For this open View|Project, go to Name of Target,
right button of Mouse, TargetExpert and change Platform.
This function works  only in Win32 Platfrom!
Regards, Alex
0
dschAuthor Commented:
Alex
No it is definatley a win32 app, I think chensu was right regarding the lib file. Sorry :-(

chensu,
Hi there again. I think you are right, with what you said.
So I have tried to use the IMPLIB feature on BC4.52 using the command from D:\BC45 directory
IMPLIB -w ..\LIB\advapi32.LIB c:\w95\system\advapi32.dll

This is supposed to create the lib file from the dll file. However it gives me this message:

>>
D:\BC45\LIB>IMPLIB -w ..\LIB\advapi32.LIB c:\w95\system\advapi32.DLL

Turbo Implib Version 2.0 Copyright (c) 1991, 1994 Borland International

Exception C0000005: Access violation
Module: IMPLIB.EXE Start address: 00410000
EAX=006A1300 EBX=79DC77F3 ECX=FFFFFFFF EDX=006A1380 ESI=006A1180
EDI=79DC77F3 EIP=00416757 EBP=0068FCB8 ESP=0068FCB4 EFL=00010246
>>

If you resubmit your message I will accept it.
And if by any chance anybody has a copy of the advapi32.LIB file,
please could you email it to me at
dschmider@iname.com

Thanks so much
David

0
NickRepinCommented:
1) make sure you are not declared RegOpenKeyEx anywhere in your program (windows.h make it for you) -  its very important (i'm not seen 'faster' example, it whould be better if you past it here as comment)
2) you need no to link advapi32, or use implib, because all imports for Win32 already in Borland's import32.lib.
0
NickRepinCommented:
I'm sorry, type errors in my answer:  ... it would be better if you post it ...

0
NickRepinCommented:
Also, you may try to 'rebuild all' your project.
May be, there is a problem with Borland C installation - you may try to re-install it.

Again, you should not care about import libraries in Borland C - compiler do it for you.

Probably, this link error may exist if you declared RegOpenKeyEx in your app, and you compile it in C++ mode.

Also, do not include <winreg.h> - all declaration already in <windows.h>
0
thresher_sharkCommented:
dsch - I have sent two different copies of the file you mentioned to the account dschmider@iname.com.  If you have any problems getting the file, please reply to the email or post here.  Good luck!
0
NickRepinCommented:
For Borland C++, the problem is not in advapi32.lib.
Borland even doesn't ship it in installation.
0
dschAuthor Commented:
It does not seem to be a compiler problem, as I have reinstalled it. I think this may be something in the program that has caused it to happen.
Does any one think it is unusual to have 2 ** in a message like this:
Linker Error: Unresolved external 'RegOpenKeyExA(HKEY__*,const
char*,unsigned long,unsigned long,HKEY__**)' referenced from module
REGREAD.CPP
ie HKEY__**  . I have never remembered seeing that before
I will see what I can find.

thresher_shark: just to say thanks for the files, although it didn't solve the problem. It was very kind of you.
David

0
thresher_sharkCommented:
No problem, it was worth a shot. :-)
0
dschAuthor Commented:
Hi there, (Very sheepish and embarassed) :-|
You are not going to believe this, but I copied and pasted the same code into another program and it all worked.
(So it had to be something in my code.)
I then searched all files that contained text "RegOpenKeyEx" within my included .cpp files, and I found that I had put another declaration for the RegOpenKey function in one of the far outpost .cpp files.
I usually copy & paste out of the help into my source code, then fill in the parameters so I don't miss one out. But for some reason I have left it in.
Perhaps it was late at night. (Yawn)
Obviously, this is another reason why nobody pays me to do this stuff yet!
Any way,
Thankyou for all your help, and I apologise for wasting anyones time.
Best Regards to you all
David Schmider
This is the hardest Submit button I have ever had to click in my life... Here goes...

0
NickRepinCommented:
dsch, please do read my previous (and rejected by you!) answer with little bit more attention:

>1) make sure you are not declared RegOpenKeyEx anywhere in your >program (windows.h make it for you) -  its very important

As you see, I've offered right solution for you 2 days before.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dschAuthor Commented:
Nick
Good point, I apologise profusely. Trust me! not only can I not program, I can't read either. :-)
Thankyou so much and Best Regards
David
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.