1

I am working on a code in CUDA C on VS2008 ,Win 7. I got a matrix of float which is to be displayed as image ..i saved it as .bin file and load it in a separate .cpp file and successfully formed the image using CImg library...however when i try to add the similar code to .cu file it gives a strange error as shown below on compilation...

 error: identifier "_ZN12cimg_library4cimg9superset2IfffE4typeE" is undefined

The code snippet i tried adding in .cu file is given as under

#include <CImg.h>
using namespace cimg_library;
....host code.....continues...

CImg<float> img1(448,448); 
for (int nn=0;nn<200704;nn++)
img1[nn] = dR[nn];    // dR is obtained after cudamemcpy DtoH
img1.display();

At forums i cant find much help regarding this as well as use of CImg with Cuda.. is there any way i can use CImg with cuda..

Thanks

snabbasi
  • 129
  • 3
  • 12
  • "when i try to add the similar code to .cu file"... could you show us what you put in the .cu file? – Bart Jul 29 '11 at 17:14

1 Answers1

1

My suggestion is to move the code that uses CImg to a .cpp file. The code in the .cpp file would then invoke the host/device code in the .cu file. The code in the .cu file then returns a pointer or reference to the matrix of floats back to the code in the .cpp file.

Nvidia's nvcc is a compiler driver. It invokes a C/C++ compiler to compile files with a .c or .cpp file name. However, a .cu file has special meaning to nvcc. It does some parsing and what-not to look for kernel functions and certain #pragmas. I'm not an expert, but I know there is a copy a manual floating around. Here is a link to an older copy of the manual.

ahoffer
  • 6,347
  • 4
  • 39
  • 68
  • thanks for the reply ...i tried it and got my code running... But still the image is not displaying...i mean its the imgdisplay command in CImg at which the code doesnt stops responding but waits for the time i close the result window ...is there some kind of check not to show any new window with cuda rules .. – snabbasi Jul 30 '11 at 08:19