I have installed Microsoft Visual Toolkit 2003 and Platform SDK 2003 SP1,
and setting C::B like this
"Compiler" tab:
D:\Program Files\PlatformSDK\Include
D:\Program Files\CodeBlocks\Include
"Linker" tab:
D:\Program Files\PlatformSDK\Lib
D:\Program Files\CodeBlocks\Lib
"Resource compiler" tab:
D:\Program Files\PlatformSDK\Include
after this.i complied my code
but it still warn like this :
main.obj error LNK2019: unresolved external symbol __imp__RegOpenKeyA@12
i know that because link can't find the lib file
how to setting the C::B to include lib file?
thanks a lot.
Quote from: code_tin on August 28, 2005, 10:27:08 AM
"Compiler" tab:
D:\Program Files\PlatformSDK\Include
D:\Program Files\CodeBlocks\Include
"Linker" tab:
D:\Program Files\PlatformSDK\Lib
D:\Program Files\CodeBlocks\Lib
"Resource compiler" tab:
D:\Program Files\PlatformSDK\Include
First of all: You are mixing compilers here: I assume you've installed Code::Blocks with MinGW (otherwise you would not have an include/lib folder there). You should not mix headers/libraries from Microsoft Platform SDK (D:\Program Files\PlatformSDK\Include) with those from MinGW (D:\Program Files\CodeBlocks\Include). So: Where is your Visual C++ installation? Or did you really install Visual C++ into the Code::Blocks-directory?
If you want to use Code::Blocks with Visual C++ only I suggest you install the compiler-free version. Otherwise make sure you setup the compiler correctly:
1.) Settings->Compiler, choose Visual C++
2.) Settings->Compiler->Visual C++, Directories for Compiler, Linker and Resource-Compiler (Visual C++ AND platform SDK in your case)
3.) Settings->Compiler->Visual C++, Programs -> Make sure you setup the root-path to VC++ here (not platform-SDK)
Furthermore IMHO one normally never installs compilers in a folder that contains spaces (but that's another story...)
Morten.
MortenMacFly is right,
Quote
D:\Program Files\CodeBlocks\Include
D:\Program Files\CodeBlocks\Lib
These look suspicious... :) (do they point to VCTK instalation directory?)
Quotehow to setting the C::B to include lib file?
- right click on your project, then click "Build Options"
- navigate to "Linker" tab
- add appropriate libraries (ones that you use) to the project using "Add" button
Quote from: code_tin on August 28, 2005, 10:27:08 AM
main.obj error LNK2019: unresolved external symbol __imp__RegOpenKeyA@12
All the other posters are right.
Still, the error you 're getting is probably because you haven't added a required library (I think it's advapi32.lib but don't take my word for it)...
Yiannis.
thanks all for answer my question.but ...
1. I have change the build option to VCTK 2003, so C::B will no longer use the MinGW's Include and Lib
2. my all programs are installed in D:\, so the VCTK Inlucde and Lib path are right.
3. I know this problem is cause by lake of LIB files,this is the problem that i want to ask.why i add SDK Lib path to C::B VCTK build path,but it looks like doesn't work... :( all API call's warning.
thanks..
thanks Morten's help.
this setting is not only what i have tryed.
i try a lot of ways:
1.only SDK.
2.SDK+VCTK
3.SDK+MinGW
I know the correct setting is like this:
Compiler:
D:\Program Files\Microsoft Visual C++ Toolkit 2003\include
D:\Program Files\Microsoft Platform SDK\Include
Linker:
D:\Program Files\Microsoft Visual C++ Toolkit 2003\lib
D:\Program Files\Microsoft Platform SDK\Lib
Resource compiler:
D:\Program Files\Microsoft Platform SDK\Include
I have tryed this setting.but it doesn't work too:(
i have try to add advapi32.lib to project ->build options-> Linker Options
it worked
but if i want to use any WIN32API.
i should add LIB one by one? even i use api like MessageBoxA ?
why the Directories->Linker doesn't work?
This is how all compilers work. If you do the same under MSVS it will link to a whole bunch of .lib files by default. I think the linker is smart enough to match this up and only pull in libraries which are actually used.
thank you.
MSVC cover this fact so I'm never need to include some BASE lib before(like user32.lib )
thanks all of you.