问题描述
- CXX0017:错误,没有找到符号
-
![#include "cula_lapack_device.h" #include "iostream" #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <cuda_runtime.h> #include <cublas_v2.h> #include "cuda.h" #include <math_functions.h> #include "windows.h" //主函数; extern "C" void FNSGA_GPU(void const * const host_data,size_t const width,size_t const height,size_t const bands,size_t const type,int const numofduanyuan,float *time_elapsed,float *cula_time_elapsed) { //初始化; cudaError_t cudaStat; cublasStatus_t stat; cublasHandle_t handle; int numPixel=height*width; int i=0; int j=0; int pos=0; int* duanyuanIndex=NULL; if (type==1||type==2||type==3) { float* Vt=NULL; float* Mt; float result=0; int e1=0,e2=0,e3=0; float* d_Vt=0; stat=cublasCreate(&handle); float* d_Mt; float *temp_data=(float *)host_data; duanyuanIndex=(int *)malloc(sizeof(duanyuanIndex[0])*numofduanyuan); //申请主机端空间; Vt=(float *)malloc(sizeof(*Vt)*bands); Mt=(float *)malloc(sizeof(*Mt)*numPixel); //申请设备端空间; cudaStat=cudaMalloc((void**)&d_Vt,bands*sizeof(*Vt)); cudaStat=cudaMalloc((void**)&d_Mt,numPixel*sizeof(*Mt)); //求第一个端元; for (int i=0;i<numPixel;i++) { for (int j=0;j<bands;j++) { pos=i+j*numPixel; Vt[j]=temp_data[pos]; } stat=cublasSetVector(bands,sizeof(Vt[0]),Vt,1,d_Vt,1); stat=cublasSnrm2(handle,bands,d_Vt,1,&result); Mt[i]=result; } stat=cublasSetVector(numPixel,sizeof(Mt[0]),Mt,1,d_Mt,1); stat=cublasIsamax(handle,numPixel,d_Mt,1,&e1); duanyuanIndex[0]=e1; } }
图片说明](http://img.ask.csdn.net/upload/201603/14/1457941404_844286.png)
解决方案
从程序和图片上看,没有找到符号的这个语句中的所有变量都应该是声明过的.出现这个问题,没有完整程序的情况下,我怀疑可能是obj文件出问题了,
你先重新编译一遍看一下.
时间: 2024-12-22 13:56:51