求助:关于异步时钟
请问一下在cvi7.0与cvi8.0中对异步时钟的定义有什么不同吗?为什么在7.0里编译能通过的程序在8.0里面编译时总是提示有错呢?提示连接错误.出错信息如下:Undefined symbol '_NewAsyncTimer@24' referenced in "ScanFrq.c".
Undefined symbol '_DiscardAsyncTimer@4' referenced in "ScanFrq.c".
Undefined symbol '_SetAsyncTimerAttribute' referenced in "ScanFrq.c".
请高手帮我分析一下原因!
[ 本帖最后由 tonwelzt 于 2008-7-3 10:24 编辑 ] 兄弟最好上传程序,这样方便编译调试查错!不然不容易查出来的!比如您这种情况有些是没有添加相应的LIB的原因!
回复 2# cpubbs 的帖子
下面是主程序。请大狭帮忙查找一下出错的原因,小弟先在这里拜谢了。#include <windows.h>
#include "excel2000.h"
#include <analysis.h>
#include "toolbox.h"
#include <rs232.h>
#include "analysis.h"
#include <mmsystem.h>
#include <asynctmr.h>
#include <utility.h>
#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
#include "ScanFrq.h"
static ExcelObj_App ExcelAppHandle = 0;
static ExcelObj_Workbooks ExcelWorkbooksHandle = 0;
static ExcelObj_Workbook ExcelWorkbookHandle = 0;
static ExcelObj_Window ExcelWindowHandle = 0;
static ExcelObj_Sheets ExcelSheetsHandle = 0;
static ExcelObj_Worksheet ExcelWorksheetHandle = 0;
static ExcelObj_Range ExcelRangeHandle = 0;
static ExcelObj_Dialog DialogHandle = 0;
static VARIANT MyCellRangeV;
static ERRORINFO ErrorInfo;
BSTR TempBSTR=0;
char fileName;
WAVEFORMATEX m_WaveFormatEx;
HWAVEOUT m_hPlay;
HWAVEIN m_hRecord;
LPWAVEHDR OutlpHdr, InlpHdr;
#define SamplesRate11000
int CycNum;
static int SamplesLength, InputNum;
double Vrms0=0, Vrms;
int Fo=0, FoCount=0, VrmsCount=0, Count=0;
static double MeanVal, StdDist, MeasArray;
short *iOutput, *iInput;
double *fOutput, *fInput,*f1Output;
double *sineWave=NULL;
double Phase=0.0;
static int panelHandle;
static int StartFrq, StopFrq, StepFrq, ATimerCount;
static double StepTime, Level, freq, sinefreq;
static int ATimerID=0;
int CVICALLBACK ATimer_Process (int panel, int control, int event,void *callbackData,
int eventData1, int eventData2);
int Test(void);
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1;
CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED);
SetSleepPolicy (VAL_SLEEP_MORE);
if ((panelHandle = LoadPanel (0, "ScanFrq.uir", PANEL)) < 0)
return -1;
Clear1D (MeasArray, 30);
Count=MeanVal=StdDist=0;
SetCtrlVal(panelHandle, PANEL_Count, Count);
SetCtrlVal(panelHandle, PANEL_Avage, MeanVal);
SetCtrlVal(panelHandle, PANEL_STD_V, StdDist);
do
{
ATimerID=NewAsyncTimer(0.01, -1, 0, ATimer_Process, 0);
}
while(ATimerID<=0);
OpenComConfig(1, "", 9600, 1, 8, 1, 256, 256);
memset(&m_WaveFormatEx,0x00,sizeof(m_WaveFormatEx));
m_WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
m_WaveFormatEx.nChannels = 1;
m_WaveFormatEx.wBitsPerSample = 16;
m_WaveFormatEx.cbSize = 0;
m_WaveFormatEx.nSamplesPerSec = SamplesRate;
m_WaveFormatEx.nAvgBytesPerSec = m_WaveFormatEx.nSamplesPerSec*(m_WaveFormatEx.wBitsPerSample/8);
m_WaveFormatEx.nBlockAlign = (m_WaveFormatEx.wBitsPerSample/8)*m_WaveFormatEx.nChannels;
DisplayPanel (panelHandle);
RunUserInterface ();
waveOutReset(m_hPlay);
waveOutClose(m_hPlay);
waveInReset(m_hRecord);
waveInClose(m_hRecord);
if (iOutput) free(iOutput);
if (fOutput) free(fOutput);
if (iInput) free(iInput);
if (fInput) free(fInput);
DiscardPanel (panelHandle);
CloseCom (1);
DiscardAsyncTimer (-1);
return 0;
}
*******************************************************************
编译时具体的出错信息如下:
3 Project link errors
——Undefined symbol '_NewAsyncTimer@24' referenced in "ScanFrq.c".
——Undefined symbol '_DiscardAsyncTimer@4' referenced in "ScanFrq.c".
——Undefined symbol '_ATimer_Process' referenced in "ScanFrq.c".
********************************************************************* 压缩一下程序上传吧兄弟,这样没有办法调试的!在CVI中调试比较容易查到原因!直接贴上来,很多相关的东西都没有,没有办法查的,比如一些相关的面板之类的,呵呵!allqq-mogudiandian-35all
回复 4# cpubbs 的帖子
谢谢大狭了已经上传了!回复 4# cpubbs 的帖子
我这里还有另外一个项目的程序,我考过来在我的8.0里面调试好象也有同样的问题的,并且都是连接错误。 int CVICALLBACK ATimer_Process (int panel, int control, int event,void *callbackData,int eventData1, int eventData2);
这个只有定义,没有函数实体,估计是一个文件损失! 至于您上面说到的那几个问题,将它的这个FP加上就可以解决了,但这个文件损失的没有办法,我一会找一下路径给您看加哪个FP! C:\Program Files\National Instruments\CVI85\toolslib\toolbox\asynctmr.fp
将它添加到项目中即可!那几个问题就可以解决了,上面那另外一个缺失的函数的,您得找原作者要!
回复 9# cpubbs 的帖子
多谢多谢了!我按照您说的方法添加后已经可以调试通过了,多谢大狭帮忙。嘿嘿 这个问题已经困绕小弟好几天了。 异步时间控件不是怎么好用的是由系统多媒体时钟控制不影响其他程序,但是会“卡” 楼主您好!请问下面这句话的作用是什么?正在迷惑中,请帮忙指点迷津!谢谢阿!
static ExcelObj_App ExcelAppHandle = 0;
页:
[1]