Hi,<br>   I cannot compiling a source file with petsc.h and cusp headers like the following:<br><br>#include&quot;petsc.h&quot;<br>#include&lt;iostream&gt;<br>#include &quot;cusp/csr_matrix.h&quot;<br>#include &lt;cusp/krylov/cg.h&gt;<br>
int main(void){<br>    std::cout&lt;&lt;&quot;Hello World!&quot;&lt;&lt;std::endl;<br>    return 0;<br>}<br><br>I use the following  to compile it:<br><br>nvcc  -m64 -O -arch=sm_13  -c --compiler-options=&quot;-Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O -I/home/guest/sgu1/softwares/petsc-dev/include -I/home/guest/sgu1/softwares/petsc-dev/helena-cxx-nompi-os64-release/include -I/usr/local/cuda/include -I/home/guest/sgu1/softwares/cusp-library/ -I/home/guest/sgu1/softwares/thrust/ -I/home/guest/sgu1/softwares/petsc-dev/include/mpiuni  -DCUDA=1 -I/home/guest/sgu1/softwares/slepc-dev -I/home/guest/sgu1/softwares/slepc-dev/helena-cxx-nompi-os64-release/include -I/home/guest/sgu1/softwares/slepc-dev/include -I/home/guest/sgu1/softwares/ImageMagick-6.7.2/include/ImageMagick  -D__INSDIR__= -I/home/guest/sgu1/softwares/slepc-dev -I/home/guest/sgu1/softwares/slepc-dev/helena-cxx-nompi-os64-release/include -I/home/guest/sgu1/softwares/slepc-dev/include&quot; MyKspTmp4.cu -o MyKspTmp4.o<br>
<br>and it gives me error:<br>/usr/local/cuda/include/thrust/detail/device/cuda/detail/b40c/vector_types.h(37): error: expected an identifier<br><br>I think I did not do it in a correct way. I took a a look at some of petsc&#39;s .cu files, they usually include a  long list of headers. Can petsc.h directly included in a source code with cusp headers? What&#39;s the correct way to do it?  Does the makefile system in petsc provide the command or flags to do that? How can I obtain those flags? <br>
<br>And after I compile it and obtain .o files, can I use g++ to link the .o files with petcs libs and other .o files as usual, i.e.,<br>    g++ -o $(BIN_DIR)/$@ $(CPPFLAGS) $@.s $(objects) $(PETSC_LIB) $(OTHERS)<br>or I need to do some extra steps and some specific linking flags to do that?<br>
Thanks.  <br><br>Shiyuan <br><br><br><br>