comctl32.lib question

This is a discussion on comctl32.lib question within the Windows Programming forums, part of the Platform Specific Boards category; Hi there, I am making a status bar for a win32 application and I've run into some problems. I recently ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    49

    comctl32.lib question

    Hi there,

    I am making a status bar for a win32 application and I've run into some problems. I recently started using VC++ Express Edition 2008 and when I compile my program I get this error message...

    Code:
    main.obj : error LNK2019: unresolved external symbol __imp__InitCommonControlsEx@4 referenced in function _WinMain@16
    I've included commctrl.h in my program so the cause of this error must be because I haven't included the comctl32.lib. How do I do this? I saw one solution which requires entering a pragma comment to load that library but some people on this forum have said this is not desirable. I would like to do it the proper way. I can pull up my projects properties menu by going to Properties >> "project name" Properties but I don't know what to do from there since VC++ is new to me (I was using Dev C++). Microsoft SDK is installed and I can see the comctl32.lib file in the Microsoft SDK lib folder in my Program Files directory. I guess I need to include this somehow but I'm not sure how. Can someone tell me how to do this?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    In the project view (usually on the left hand side of your workspace), you right-click on the project-name [e.g. myprogram], the bottom item of the menu that comes up is "Properties".

    In the properties, you should select "All configurations" [at the top bar], and then select the linker options, suboption "Additional libraries" and add "comctl32.lib" to the list [it is probably empty at the moment].

    You may have to apply some "fuzzy logic" to the above description, as I haven't got Visual studio here to confirm the exact names and positions of things, but that is it from memory.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    49
    Hi there,

    I found the properties menu you described and clicked on the Linker option. I added the path to ComCtl32.Lib in the "Addition Libraries Directories" field (which was C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib). However, I still get the same error. Here is a screenshot of my projects properties menu for the linker section you told me to access. Did I do something wrong? Thanks.

    http://img99.imageshack.us/img99/7673/configjx5.jpg

  4. #4
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    click the Command Line entry under Linker in Configuration Properties and add comctl32.lib on the command line options you see there.

  5. #5
    Registered User
    Join Date
    Jan 2006
    Posts
    49
    That works, thanks for your help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Is comctl32.lib required for progress bar controls?
    By JasonD in forum Windows Programming
    Replies: 4
    Last Post: 08-28-2004, 02:30 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21