無可用源 ” , “此模塊的除錯資訊中缺少源資訊

程式一開始運行的沒問題 ,在之后的除錯中,不知道因為哪個操作后程式在運行的時候會產生斷點,而且感覺是隨機的,因為好多地方都有斷點,試過網上能查到的辦法,都不起作用,編了好長時間的程式突然不能運行了心態崩了orz
test.cpp的代碼
#include "test.h"
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<cmath>
#include"engine.h"
#include<windows.h>
#include <QComboBox>
#include <QLayout>
#include <iostream>
#include<string>//定義字串
#include <QApplication>
#include <QWidget>
#pragma comment(lib,"libeng.lib")
#pragma comment(lib,"libmx.lib")
#pragma comment(lib,"libmat.lib")
Test::Test(QWidget *parent) //調整圖片
: QMainWindow(parent)
{
ui.setupUi(this);
QImage Image;
Image.load("E:/QT/WORK/Test/Test/1400_01.gif");
QPixmap pixmap = QPixmap::fromImage(Image);
int with = ui.label_6->width();
int height = ui.label_6->height();
QPixmap fitpixmap = pixmap.scaled(with, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); // 飽滿填充
//QPixmap fitpixmap = pixmap.scaled(with, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); // 按比例縮放
ui.label_6->setPixmap(fitpixmap);
}
//% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%
void Test::on_conduct_2_clicked() //conduct
{
//獲取輸入引數
QString w = ui.label->text();
QString q = ui.label->text();
int qxs = q.toInt();
//檢查是否有輸入 messagebox函式 出報錯對話框
QString aa = ui.label_7->text();
if (aa == "djbzz")
{
if (w.isEmpty())
{
MessageBoxA(NULL, "Error in intput", "Error", MB_OK); //通常我們手動輸入的字串都是const char*(即LPCSTR)型別的,因此只需將該句中的MessageBox改為MessageBoxA即可。
// MessageBox(NuLL,"str","str",MB_OK)
//MB_OK是按鈕型別
return;
}
else
{
//檢查引擎
Engine *ep; // open engine
if (!(ep = engOpen("\0")))
{
fprintf(stderr, "\nCan't start MATLAB engine\n");
/*return;*/
}
//方向圖函式
int L = qxs;
const double PI = 3.1415926;
double *t = new double[L];
double *p = new double[L];
for (int i = 0; i < L; i++)
{
t[i] = 2 * PI*i / L;
}
for (int i = 0; i < L; i++)
{
p[i] = 1;
}
mxArray *T = NULL, *result = NULL;
T = mxCreateDoubleMatrix(1, 1, mxREAL); //應該是對mxArray *A這個指標所指的矩陣進行記憶體的申請,m是待申請矩陣的行數,n是待申請矩陣的列數
mxArray *P = NULL, *result1 = NULL;
P = mxCreateDoubleMatrix(1, 1, mxREAL);
memcpy((void*)mxGetPr(T), (void*)t, L * sizeof(t[0]));
memcpy((void*)mxGetPr(P), (void*)p, L * sizeof(t[0]));
engPutVariable(ep, "theta", T);//引號中的為matlab中的變數
/* engPutVariable(ep, "r", P);*/
engEvalString(ep, "djbzz");//呼叫m檔案
//engEvalString(ep, "f=sin(theta);");
//engEvalString(ep, "f=abs(f);");
//engEvalString(ep, "subplot(1,2,1);");
//engEvalString(ep, "polar(theta,f);");
//engEvalString(ep, "title('E面方向圖');");
//engEvalString(ep, "subplot(1,2,2);");
//engEvalString(ep, "polar(theta,r,'m');"); //需要交聯c與matlab中R的變數 即按上述L程序從新定義
//engEvalString(ep, "title('H面方向圖');");
//engEvalString(ep, "f=sin(theta);f=abs(f);");
//engEvalString(ep, "for k=1:L r(k) =1;end");
//engEvalString(ep, "subplot(1,2,1);polar(theta,f);title('E面方向圖');title('E面方向圖');subplot(1,2,2);polar(theta,r,'m');title('H面方向圖');");//可以一條陳述句
for (int i = 0; i <=1000; i++) //加載框進度加載
{
ui.progressBar->setValue(i);
}
ui.label->clear();
}
}
if (aa=="jymz")
{
}
}
void Test::on_clean_clicked()
{
ui.checkBox->setChecked(false);
ui.checkBox_2->setChecked(false);
ui.checkBox_3->setChecked(false);
ui.label->clear();
ui.label_2->clear();
ui.label_3->clear();
ui.label_4->clear();
ui.label_5->clear();
}
void Test::on_checkBox_clicked()
{
}
void Test::on_checkBox_2_clicked()
{
}
void Test::on_checkBox_3_clicked()
{
}
//void Test::on_push_clicked()
//{
// QString aa = ui.label_7->text();
// if (aa=="djbzz")
// {
// ui.label_4->setText(aa);
// }
// /*ui.label_4->setText(aa);*/
//}
void Test::on_pushButton_clicked()//置入天線方向函式
{
ui.comboBox->clear();
ui.comboBox->addItem("djbzz", 1);
ui.comboBox->addItem("jymz",2);
ui.comboBox->addItem("shiyan", 3);
}
void Test::on_comboBox_currentIndexChanged(const QString &arg1)
{
ui.label_7->setText(arg1);
double aa = arg1.toDouble();
test.h的代碼
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_test.h"
#include <QProgressBar>
class Test : public QMainWindow
{
Q_OBJECT
public:
Test(QWidget *parent = Q_NULLPTR);
int x, y;
private:
Ui::TestClass ui;
QProgressBar *progressBar; //進度條 不用定義到 private solts
private slots:
void on_clean_clicked();
void on_conduct_2_clicked();
void on_checkBox_clicked();
void on_checkBox_2_clicked();
void on_checkBox_3_clicked();
/*void on_push_clicked();*/
/*void on_comboBox_clicked();*/
//void on_checkBox_stateChanged(int arg1);
//void on_checkBox_2_stateChanged(int arg1);
//void on_checkBox_3_stateChanged(int arg1); //用于開關互斥
//不寫函式 不能定義
void on_pushButton_clicked();
void on_comboBox_currentIndexChanged(const QString &arg1);
};
uj5u.com熱心網友回復:
應該是你的程式崩潰了或者拋出例外了,沒有源指的是呼叫的系統函式沒有源代碼資訊,這個時候中斷下來,看一下堆疊,看是哪里的問題uj5u.com熱心網友回復:
這頁面往下拉,最頭上紅字這兩條,希望對你有幫助:
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/272652.html
標籤:C++ 語言
