0

I know I asked this yesterday already but the suggested solution in this thread:

error LNK1120: 1 unresolved external - VS13 C

Did not work :/

I am getting this error:

CMakeFiles\testproject.dir/objects.a(main.cpp.obj): In function 
`Win32xx::LoadCommonControls()':
PATH/lib/Win32xx891/include/wxx_wincore.h:2844: undefined reference to 
`__imp_InitCommonControls'
PATH/lib/Win32xx891/include/wxx_wincore.h:2849: undefined reference to 
`__imp_InitCommonControls'

while trying to run example code from the win32++ library. I have tried adding

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

To my header as was suggested in the thread I mentioned but that didn't work. They also said that you can solve it by linking the comctl32 library, which appearently isnt loaded and causes the issue, by adding -L -lcomctl32 to my program arguments (I think thats how to do it, correct me if im wrong). That didnt help either. If you know what the problem is please help me.

EDIT:

steps:

  • create project (c++ 14)
  • download win32++ library files
  • add them with cmake (I called include_directories(), is that enough?)
  • https://pastebin.com/w59ibVEZ
  • run program with "-lcomctl32" as program argument
  • rip

1 Answers1

0

#pragma comment(lib, "comctl32.lib") is for MSVC, it doesn't do anything in MinGW (or GCC for that matter).

Symbol InitCommonControls is defined in libcomctl32.a which comes with MinGW, so you just need to link against by using linker flag -lcomctl32.

Make sure to tell CMake it's a linker flag and not a compiler flag.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40