qt 链接库的添加

来源:互联网 发布:淘宝上买片关键词 编辑:程序博客网 时间:2024/05/18 23:25
1.error while loading shared libraries: libavdevice.so.54: cannot open shared object file: No such file or directory
就是把/usr/local/ffmpeg/lib这个目录加入到/etc/ld.so.config中,然后执行ldconfig,或者重启电脑,这样执行的时候系统就可以从/usr/local/ffmpeg/lib这个目录下去找这三个动态库文件了。
2.qt添加文件
    qmake -project
    qmake name.pro
    在Qt中工程通过.pro文件管理,所以库文件要在.pro文件中添加。
    1.添加库文件
    静态库
    linux:LIBS += your_lib_path/your_lib
    动态库
    linux:LIBS += -L your_lib_path -lyour_lib//经过测试了
    win32:LIBS += your_lib_path/your_lib
    例如:
    LIBS += -L lib/pcsc/ -lpcsclite
    LIBS += lib/pcsc/libpcsclite.a
    2.添加头文件
    INCLUDEPATH += your_include_path
    例如:
    INCLUDEPATH += . /usr/local/include(点号后面有空格)
    3.添加要编译的源文件和头文件
    SOURCES:所有源文件列表
    HEADERS:所有头文件列表
    FORMS:所有.ui文件列表
    前期工作:
    1.检查gcc,g++,qmake是否用错。
    2.在Makefile中检查是否少了头文件
    3.检查是否“”与<>错用了
    4.需要另外加库的程序最好单独建一个文件
3.Qt  界面编辑后无效果
   项目文件里面,make clean 删除*ui.h 然后再执行make
4.QThread::start ()
void QThread::start ()
通过调用run()(必须在QThread子类中重新实现来包含你的代码)开始这个线程的执行。如果你试图开始一个已经运行的线程,这个调用将一直等待,直到这个线程完成,然后再重新开始这个线程。
5.int QEventLoop::exec ( ProcessEventsFlags flags = AllEvents )
Enters the main event loop and waits until exit() is called. Returns the value that was passed to exit().
It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.

原创粉丝点击