解决方案1:在cpp文件中放置.c,且在该文件中引用变量
解决方案2:在一个cpp文件中包含.c,但在另一个cpp文件中使用结构体变量
cpp文件1
cpp文件2
#include "dialog3.h" #include <QDebug> extern "C" { typedef struct PRINT { unsigned char Parameters;//BitDepthAC,BitDepthDC,q unsigned char PlaneCodes;//指定段的某一个位平面所有的码流 unsigned char PlaneCodesSeparate;//指定段某个位平面的所有码流,不同的码字是分开的 unsigned char PlaneIndex; unsigned char PlaHit; unsigned char AllCodesPrint;//所有的码流,并行,串行 unsigned short SegIndex; unsigned char SegHit; unsigned int BlockIndex; unsigned char BlockHit; unsigned char BlockScanPrint;//指定段中某个块的扫描字 unsigned char Option; unsigned char WordToCode; unsigned char BlockCodes;//single block unsigned char GagHit; unsigned int GagIndex; unsigned char BlockBeforeScan; unsigned char Header; unsigned char DC_DPCM; unsigned char DC_RiceCodes; unsigned char AC_Depth_DPCM; unsigned char AC_DepthRiceCodes; unsigned char DC_Additional; unsigned char DC_Refinement; unsigned char Stage1; unsigned char Stage2; unsigned char Stage3; unsigned char Stage4; unsigned char DWT_PRINT; unsigned char IDWT_PRINT; unsigned char PlaneTime_Print; unsigned char ScanTime_Print; }PrintPara; extern PrintPara Print; } Dialog3::Dialog3(QWidget *parent) : QDialog(parent) { ui.setupUi(this); ui.checkBox_3->setChecked(true); ui.checkBox_4->setChecked(true); }
不知道是什么原因,但是实验证明可行