Author Topic: can't Integrate VC 2003 TOOLKIT with C::B  (Read 4728 times)

Offline code_tin

  • Single posting newcomer
  • *
  • Posts: 5
can't Integrate VC 2003 TOOLKIT with C::B
« on: August 28, 2005, 10:27:08 am »
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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #1 on: August 28, 2005, 10:46:04 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #2 on: August 28, 2005, 10:54:45 am »
MortenMacFly is right,
Quote
D:\Program Files\CodeBlocks\Include
D:\Program Files\CodeBlocks\Lib
These look suspicious... :) (do they point to VCTK instalation directory?)

Quote
how 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
this space is for rent

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #3 on: August 28, 2005, 11:29:20 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.
Be patient!
This bug will be fixed soon...

Offline code_tin

  • Single posting newcomer
  • *
  • Posts: 5
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #4 on: August 28, 2005, 01:39:01 pm »
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..

Offline code_tin

  • Single posting newcomer
  • *
  • Posts: 5
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #5 on: August 28, 2005, 01:49:22 pm »
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:(

Offline code_tin

  • Single posting newcomer
  • *
  • Posts: 5
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #6 on: August 28, 2005, 01:54:54 pm »
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?

Offline grv575

  • Official tester
  • Regular
  • ***
  • Posts: 381
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #7 on: August 28, 2005, 03:23:31 pm »
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.

Offline code_tin

  • Single posting newcomer
  • *
  • Posts: 5
Re: can't Integrate VC 2003 TOOLKIT with C::B
« Reply #8 on: August 28, 2005, 03:41:00 pm »
thank you.
MSVC cover this fact so I'm never need to include some BASE lib before(like user32.lib )
thanks all of you.
« Last Edit: August 28, 2005, 03:44:01 pm by code_tin »