Reputation: 51
I'm trying to actually use -Wall and remove all warnings in my current program. I know this isn't required but it seems like it can't hurt and hasn't proven to be too time consuming.
I'm using sockets to communicate between two programs: one in C++11 (with c sections) and another in CUDA (so NVCC as the compiler). The socket creation is very similar, and in order to prevent warnings I have written lines such as:
#include<string.h>
extern char* strcpy(char*,const char*);
This forward declaration works great with gcc/g++ to prevent a warning like:
source.c:33:4: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
strcpy(saun.sun_path,CUDA_SOCKET_ADDR);
source.c:33:4: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
However, the same code on the NVCC program yields another warning:
CUDAsource.cuh(26): warning: allowing all exceptions is incompatible with previous function "strcpy"
/usr/include/string.h(129): here
Is there another setting I need to set in my makefile? Currently the C side has the following flags:
-g -O0 -Wall -std=c99
and nvcc has:
-g -G
Any tips would be appreciated.
Thanks.
Upvotes: 1
Views: 1685
Reputation: 51
Removing the extern definitions and adding -D_GNU_SOURCE to the compiler flags resolved the issue.
Upvotes: 2