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...
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?
main.obj : error LNK2019: unresolved external symbol __imp__InitCommonControlsEx@4 referenced in function _WinMain@16
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.
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.
click the Command Line entry under Linker in Configuration Properties and add comctl32.lib on the command line options you see there.
That works, thanks for your help.