How to pass a struct from C++ to C? -
updated: main.h typedef struct { float x; float y; float z; }vec3; const int sizeofgrid = 20000; vec3 *grid[sizeofgrid];//assume initialized main.cpp #include "main.h" extern "c" void cudatranslate(vec3 *x); void display() { cudatranslate(grid); } linecuda.cu #include <stdio.h> #include <assert.h> #include <cuda.h> #include "main.h" extern "c" void cudatranslate(vec3 *x) { } getting: main.obj : error lnk2005: "struct vec3 * * grid" (?grid@@3papauvec3@@a) defined in linecuda.obj fatal error lnk1169: 1 or more multiply defined symbols found move grid main.cpp. pass linecuda.cu. problem solved. updated: main.h typedef struct { float x; float y; float z; }vec3; const int sizeofgrid = 20000; main.cpp #include "main.h" vec3 *grid[sizeofgrid];//assume initialized extern "c" void cudatranslate(vec3 *x); void display() { cudatranslate(grid)...