3

I'm trying to compile a CUDA C code in Windows command line. I've already installed cuda toolkit and nvcc works fine. But the code includes png.h and I'd like to know what is the proper way to provide it.

Specifically, I want to learn what are the default directories in which nvcc looks for headers and .dlls. And how should I install such standard C libraries: do I necessarily have to use MinGW and somehow add C:\MinGW\include and C:\MinGW\bin to the PATH?

Currently my solution looks in the following way:

$ nvcc mandelbrot-dynamic.cu -O3 -arch=sm_35 -rdc=true -lcudadevrt -Xcompiler -fopenmp -Ic:/mingw/include/ -o dynamic 

And the result is:

cl : Command line warning D9002 : ignoring unknown option '-fopenmp' mandelbrot-dynamic.cu 
c:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/amd64/../../../VC/INCLUDE\yvals.h(472) : warning C4005: '_EXTERN_C' : macro redefinition
    c:/mingw/include/_mingw.h(258) : see previous definition of '_EXTERN_C'
c:/mingw/include/float.h(38) : fatal error C1021: invalid preprocessor command 'include_next'

It doesn't complain about png.h but there is conflict between MSVC and MingW. Plus, nvcc doesn't accept a preprocessor command from a mingw header.

Maxim Blumental
  • 763
  • 5
  • 26
  • you can only use `nvcc` with MSVC on windows; did you read the documentation? http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#file-and-path-specifications – m.s. Jul 12 '15 at 14:57
  • Thanks for the reference. But I didn't get about MSVC: I looked in `C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include` and didn't find `png.h` there. You mean I should use some MS Visual Studio functionality instead of libpng for creating `png` images? – Maxim Blumental Jul 12 '15 at 15:23
  • you need to install libpng, e.g. from http://gnuwin32.sourceforge.net/packages/libpng.htm or compile it yourself – m.s. Jul 12 '15 at 15:45
  • I did it. Still: when compile with `--pre-include c:/mingw/include/png.h` it reports that no such file. When compile with `-Ic:/mingw/include/` the conflict described in question takes place. – Maxim Blumental Jul 12 '15 at 16:10

0 Answers0