问题
When compiling a project with nvcc (using cuda 3.1), I'm getting a flood of warnings from gthr-default.h:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux/bits/gthr-default.h:118: warning: ‘int __gthrw_pthread_once(pthread_once_t*, void (*)())’ declared ‘static’ but never defined
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux/bits/gthr-default.h:119: warning: ‘void* __gthrw_pthread_getspecific(pthread_key_t) throw ()’ declared ‘static’ but never defined
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux/bits/gthr-default.h:120: warning: ‘int __gthrw_pthread_setspecific(pthread_key_t, const void*) throw ()’ declared ‘static’ but never defined
I've dug around all over and can't seem to find a way to suppress this noise, short of removing -Wall, which I don't really want to do. Does this look familiar to anyone?
My CXXFLAGS are:
CXXFLAGS=-Isrc -I../cxxtest -I$(CUDA_INCLUDE_DIR) -Xcompiler -O2 -Xcompiler -Wall
I've tried adding the $(CUDA_INCLUDE_DIR) to the -Xcompiler options as well but to no avail. I don't want to remove Wall from the settings... are there any other options?
回答1:
Try separating your pthreads code into a different file so that you can avoid #including whatever file is triggering those warnings...
来源:https://stackoverflow.com/questions/7969419/nvcc-cuda-3-1-ghtr-default-h-flood-of-declared-static-but-not-defined-warnin