我想编写简单的程序,使用C ++的QT Creator,使用Allied Vision Technologies Camera捕获图像。问题是我有一些我不理解的错误。我创建了一个简单的QT控制台应用程序我在项目中添加了外部库。 (右键单击项目 - > gt;添加库,外部库,AVTVimba.lib,以及包含* .h文件的文件夹)。
我的.pro文件:
QT += core
QT -= gui
TARGET = AVT3
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Lib/Win64/ -lVimbaCPP
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Lib/Win64/ -lVimbaCPPd
INCLUDEPATH += $$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Include
DEPENDPATH += $$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Include
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Lib/Win64/libVimbaCPP.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Lib/Win64/libVimbaCPPd.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Lib/Win64/VimbaCPP.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaCPP/Lib/Win64/VimbaCPPd.lib
INCLUDEPATH +="D:\Programy\AVTVimba_1.3"
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Programy/AVTVimba_1.3/VimbaC/Lib/Win64/ -lVimbaC
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Programy/AVTVimba_1.3/VimbaC/Lib/Win64/ -lVimbaCd
INCLUDEPATH += $$PWD/../../Programy/AVTVimba_1.3/VimbaC/Include
DEPENDPATH += $$PWD/../../Programy/AVTVimba_1.3/VimbaC/Include
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaC/Lib/Win64/libVimbaC.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaC/Lib/Win64/libVimbaCd.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaC/Lib/Win64/VimbaC.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Programy/AVTVimba_1.3/VimbaC/Lib/Win64/VimbaCd.lib
一切似乎都没问题,我可以在我的项目中包含头文件VimbaCPP.h并使用AVT :: VmbAPI命名空间,并且没有任何编译错误。为了测试一切是否正常,我试图从AVT CPP手册中复制列表。
#include <QCoreApplication>
#include "VimbaCPP.h"
#include <iostream>
using namespace std;
using namespace AVT::VmbAPI;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cout<<"123"<<endl;
CameraPtrVector cameras;
// VimbaSystem &system = VimbaSystem::GetInstance();
return a.exec();
}
上面的代码编译并运行没有任何问题。 CameraPtrVector是AVT :: VmbAPI命名空间的一部分,因此我假设库已正确链接。现在当我取消注释下一行:&#34; VimbaSystem&amp; system ...&#34;我的程序不起作用,并使用代码-1073741510执行。我找不到这个问题的根源。我真的很感激一些帮助。