English 中文(简体)
将图书馆与使用kg-混凝土产出的QT项目联系起来
原标题:Linking libraries to a QT project using pkg-config output
  • 时间:2010-08-19 00:00:14
  •  标签:
  • c++
  • qt
  • qmake

这是一个新问题的范围。 我正试图在QT项目中增加开放社区图书馆。

问题说,链接旗帜是由挂着的。

pkg-config --libs opencv

如果我把指挥线输出到项目档案中,例如:

LIBS += -L/usr/local/lib -lml -lcvaux -lhighgui -lcv -lcxcore

那么,所有东西都编造了罚款,但现在,这是一纸空文。 我怎么能够简单地提及指挥的产出?

最新情况:Tried Ken Chang s 建议,但获得汇编。 实际生成的汇编者指挥部是

# How it should be, at least on my machine
g++ -o QOpenCVTest main.o qopencvtest.o moc_qopencvtest.o -L/usr/lib -L/usr/local/lib -lml -lcvaux -lhighgui -lcv -lcxcore -lQtGui -lQtCore -lpthread

# with CONFIG and PKGCONFIG
g++ -o QOpenCVTest main.o qopencvtest.o moc_qopencvtest.o -L/usr/lib -lQtGui -lQtCore -lpthread
问题回答
CONFIG += link_pkgconfig
PKGCONFIG += opencv

(我从查询。) http://beaufour.dk/blog/2008/02/using-pkgconfig.html

答案是巨大的。 我只得去除“+=一”两边的空间。

CONFIG+=link_pkgconfig PKGCONFIG+=opencv

在更新的Qt版本中,需要这样做,以避免出现一个没有错误的包裹:

QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += protobuf #or whatever package here

在澳门也须这样做:

mac {
  PKG_CONFIG = /usr/local/bin/pkg-config
}

在贵方档案中,应该这样做。

LIBS += `pkg-config --libs opencv`

Edit: Hmm, Ken Chang 回答可能更便捷,但是没有记录。

在您的档案中添加以下内容:

INCLUDEPATH += `pkg-config --cflags opencv`
LIBS += `pkg-config --libs opencv`




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签