Hey everyone, I'm having this problem with the aforementioned API.
Here is the code to initialize the common controls i want to use..(commctrl.h is already included in my program)

INITCOMMONCONTROLSEX icex;
   icex.dwSize=sizeof(INITCOMMONCONTROLSEX);
  icex.dwICC=ICC_BAR_CLASSES;
   InitCommonControlsEx(&icex);

However, when I try to build , it gives me this error:

1>tkud.obj : error LNK2019: unresolved external symbol __imp__InitCommonControls@0 referenced in function _WinMain@16
1>C:\Users\kudayisi\Documents\Visual Studio 2008\Projects\comctrl\Debug\comctrl.exe : fatal error LNK1120: 1 unresolved externals

I'm using Visual C++ 2008 Express Edition.

Any positive help on this matter would be highly appreciated.

Recommended Answers

All 6 Replies

Is comctl32.lib added to your project?

Yep, nezachem is correct, the prototypes in that header mean nothing if they aren't linked with the right library. Try linking to comctl32.lib.

I do not know how to link,please throw more light on that

The easy way, at the very start of your code, add this line:

#pragma comment(lib, "comctl32.lib")

the easiest..don't need InitCommonControlsEx(&icex); nor InitCommonControls();

#pragma comment(linker,"/manifestdependency:\"type='win32 name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

i'm sorry..:)

My project has compiled. Thanks to you all for your contributions,I
really appreciate it!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.