问题
So I had the same problem as this asker, and followed the advice of the accepted answer. I entered all the include directories given by pkg-config gtkmm-2.4 --cflags
into my project, and finally it seemed to compile without a hitch.
Then I tried pkg-config gtkmm-2.4 --libs
, and got
-LC:/gtk/lib -Lc:/devel/dist/win32/libpng-1.4.3-1/lib -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
So I dunno, I tried adding these directories (?) into the list of external libraries to be included in my project, and I get this error:
1>LINK : fatal error LNK1104: cannot open file 'C:/gtk/lib.obj'
What should I actually be putting for the list of external libraries?
回答1:
You are passing GLD parameters to Microsoft "link" what do you expect?
Either you need to pass some parameter to pkg-config so that it returns "link" compatible parameters (check its manual), or manually lookup the meaning of those parameters in the (G)LD manual, and then find corresponding parameter for link.
-L is includedirectory for LD, but it sounds like it is "link static object file/lib" for link, since it searches for a .OBJ.
来源:https://stackoverflow.com/questions/8586006/linking-gtkmm-libraries-in-visual-studio