起動時にアプリケーションがクラッシュします (デバッグおよびリリース モードを試行)。これについてはあまり経験がありませんが、助けていただければ幸いです。
.pro ファイル
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = snmpTest5
TEMPLATE = app
LIBS += -LC:\snmp\lib -lnetsnmp -lnetsnmpagent -lnetsnmpmibs
win32:INCLUDEPATH += "C:/snmp/include"
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
メインウィンドウ.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#undef DEMO_USE_SNMP_VERSION_3
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
netsnmp_session session, *ss;
netsnmp_pdu *pdu;
netsnmp_pdu *response;
oid anOID[MAX_OID_LEN];
size_t anOID_len;
netsnmp_variable_list *vars;
int status;
int count=1;
init_snmp("snmpdemoapp");
snmp_sess_init( &session );
session.peername = strdup("test.net-snmp.org");
ui->textEdit->append("test");
}
アプリケーション出力
Starting ...\snmpTest5-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\debug\snmpTest5.exe...
The program has unexpectedly finished.
...\snmpTest5-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\debug\snmpTest5.exe exited with code -1073741515
コンパイル出力
14:22:16: Running steps for project snmpTest5...
14:22:16: Starting: "C:\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\bin\qmake.exe" ..\snmpTest5\snmpTest5.pro -r -spec win32-msvc2010
14:22:18: The process "C:\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\bin\qmake.exe" exited normally.
14:22:18: Starting: "C:\QtCommercial\QtCommercial5.0.0\Tools\QtCreator\bin\jom.exe"
C:\QtCommercial\QtCommercial5.0.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
C:\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\bin\uic.exe ..\snmpTest5\mainwindow.ui -o ui_mainwindow.h
cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\..\..\..\snmp\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtWidgets" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtGui" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtCore" -I"release" -I"." -I"." -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\Furby\AppData\Local\Temp\main.obj.4600.31.jom
C:\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\bin\moc.exe -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\..\..\..\snmp\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtWidgets" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtGui" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtCore" -I"release" -I"." -I"." -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -D_MSC_VER=1600 -DWIN32 ..\snmpTest5\mainwindow.h -o release\moc_mainwindow.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\..\..\..\snmp\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtWidgets" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtGui" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtCore" -I"release" -I"." -I"." -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\Furby\AppData\Local\Temp\mainwindow.obj.4600.124.jom
mainwindow.cpp
main.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\..\..\..\snmp\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtWidgets" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtGui" -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\include\QtCore" -I"release" -I"." -I"." -I"..\..\..\..\QtCommercial\QtCommercial5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\Furby\AppData\Local\Temp\moc_mainwindow.obj.4600.312.jom
moc_mainwindow.cpp
..\snmpTest5\mainwindow.cpp(36) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\string.h(238) : see declaration of 'strdup'
..\snmpTest5\mainwindow.cpp(32) : warning C4189: 'count' : local variable is initialized but not referenced
..\snmpTest5\mainwindow.cpp(25) : warning C4101: 'response' : unreferenced local variable
..\snmpTest5\mainwindow.cpp(28) : warning C4101: 'anOID_len' : unreferenced local variable
..\snmpTest5\mainwindow.cpp(27) : warning C4101: 'anOID' : unreferenced local variable
..\snmpTest5\mainwindow.cpp(31) : warning C4101: 'status' : unreferenced local variable
..\snmpTest5\mainwindow.cpp(24) : warning C4101: 'pdu' : unreferenced local variable
..\snmpTest5\mainwindow.cpp(23) : warning C4101: 'ss' : unreferenced local variable
..\snmpTest5\mainwindow.cpp(30) : warning C4101: 'vars' : unreferenced local variable
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:release\snmpTest5.exe.embed.manifest /OUT:release\snmpTest5.exe @C:\Users\Furby\AppData\Local\Temp\snmpTest5.exe.4600.2979.jom
mt.exe /nologo /manifest release\snmpTest5.exe.embed.manifest /outputresource:release\snmpTest5.exe;1
14:22:28: The process "C:\QtCommercial\QtCommercial5.0.0\Tools\QtCreator\bin\jom.exe" exited normally.
前もって感謝します。