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) already defined in lineCuda.obj
fatal error LNK1169: one or more multiply defined symbols found
struct
definition in a header and#include
it from both the.cpp
and.cu
files. – Jeremiah Willcockstruct
definition included in both files; that was what I was pointing out. – Jeremiah WillcockcudaTranslate
don't match. (One isvec3*
, the other is justvec3
.) – Kristopher JohnsonsizeOfGrid
static
. I do not remember ifint
constants are automatically (I think so). – Jeremiah Willcock