Getting LNK2005 error with multiple files

I have code to generate different fractals which both use the same function for colouring. When I use the colouring function in two different files it gives me this error:

LNK2005	"struct Colour __cdecl paletteFunc(int,int,unsigned char *,int)" (?paletteFunc@@YA?AUColour@@HHPEAEH@Z) already defined in Julia.cu.obj	

LNK1169	one or more multiply defined symbols found
// main.cu

#pragma once
#include "cuda_runtime.h"
#include <Windows.h>
#include "MandelFunctions.h"
#include "Julia.h"

int main() {
    int deviceCount;
    cudaGetDeviceCount(&deviceCount);
    if (deviceCount == 0) {
        MessageBox(NULL, "Incompatible GPU, cannot proceed.", "Error", MB_OK | MB_ICONERROR);
        return 1;
    }

    gameLoop(1920, 1080, 1);
}
// MandelFunctions.cu
#pragma once
#include <iostream>
#include <SFML\Graphics.hpp>
#include "cuda_runtime.h"
#include <cuda.h>
#include "device_launch_parameters.h"
#include "MandelFunctions.h"
#include "Palette.cuh"






__global__ void generateMandelbrot(uint8_t* pixels, int maxIterations, size_t zoom, double xCoord, double yCoord, int width, int height, uint8_t* palette) {
    double zoomInverse = 1.0 / zoom;
    size_t stride = blockDim.x * gridDim.x;
    size_t index = blockIdx.x * blockDim.x + threadIdx.x;
    int iterations;
    while (index < width * height) {
        int x, y;
        x = index % width;
        y = index / width;
        iterations = mandelbrotIterationCheck(xCoord + (x - width / 2) * zoomInverse, yCoord + (y - height / 2) * zoomInverse, maxIterations);



        // LINK ERROR HERE
        Colour colour = paletteFunc(iterations, maxIterations, palette, PaletteFuncCycle);



        uint8_t* pixelPtr = &pixels[(y * width + x) * 4];
        pixelPtr[0] = colour.r;
        pixelPtr[1] = colour.g;
        pixelPtr[2] = colour.b;
        pixelPtr[3] = 255;
        index += stride;
    }
}




sf::Image loadMandelbrot(int maxIterations, size_t zoom, double xCoord, double yCoord, int width, int height, uint8_t* palette) {
    size_t size = width * height * 4;
    uint8_t* d_pixels, * pixels, * d_palette;
    pixels = (uint8_t*)malloc(sizeof(uint8_t) * size);
    cudaMalloc((void**)&d_pixels, sizeof(uint8_t) * size); // allocate device memory
    cudaMemcpy(d_pixels, pixels, sizeof(uint8_t) * size, cudaMemcpyHostToDevice); // assign device memory
    int paletteSize = (palette[0] << 16) | (palette[1] << 8) | palette[2];
    cudaMalloc((void**)&d_palette, 3 * sizeof(uint8_t) * (paletteSize + 1));
    cudaMemcpy(d_palette, palette, 3 * sizeof(uint8_t) * (paletteSize + 1), cudaMemcpyHostToDevice);



    // LINK ERROR IN THIS FUNCTION
    generateMandelbrot << < 1024, 256 >> > (d_pixels, maxIterations, zoom, xCoord, yCoord, width, height, d_palette);




    cudaMemcpy(pixels, d_pixels, sizeof(uint8_t) * size, cudaMemcpyDeviceToHost); // recover device memory
    std::vector<sf::Uint8> pixelVec(pixels, pixels + size);
    sf::Image image;
    image.create(width, height, pixelVec.data());
    free(pixels);
    cudaFree(d_palette);
    cudaFree(d_pixels);
    return image;
}






void gameLoop(int width, int height, bool fullscreen) {
    // executes loadMandelbrot() with interactive features
}
// MandelFunctions.h
ifndef MANDEL_FUNCTIONS_H
#define MANDEL_FUNCTIONS_H

void gameLoop(int width, int height, bool fullscreen);

#endif
// Julia.cu


#pragma once
#include <iostream>
#include <SFML\Graphics.hpp>
#include "cuda_runtime.h"
#include <cuda.h>
#include "device_launch_parameters.h"
#include "Julia.h"
#include "Palette.cuh"







__global__ void generateJulia(uint8_t* pixels, int maxIterations, size_t zoom, double xCoord, double yCoord, double realC, double imagC, int width, int height, uint8_t* palette) {
    double zoomInverse = 1.0 / zoom;
    size_t stride = blockDim.x * gridDim.x;
    size_t index = blockIdx.x * blockDim.x + threadIdx.x;
    int iterations;
    while (index < width * height) {
        int x, y;
        x = index % width;
        y = index / width;
        iterations = juliaIterationCheck(xCoord + (x - width / 2) * zoomInverse, yCoord + (y - height / 2) * zoomInverse, realC, imagC, maxIterations);


        // LINK ERROR HERE
        Colour colour = paletteFunc(iterations, maxIterations, palette, PaletteFuncCycle);


        uint8_t* pixelPtr = &pixels[(y * width + x) * 4];
        pixelPtr[0] = colour.r;
        pixelPtr[1] = colour.g;
        pixelPtr[2] = colour.b;
        pixelPtr[3] = 255;
        index += stride;
    }
}



sf::Image loadJulia(int maxIterations, size_t zoom, double xCoord, double yCoord, double realC, double imagC, int width, int height, uint8_t* palette) {
    size_t size = width * height * 4;
    uint8_t* d_pixels, * pixels, * d_palette;
    pixels = (uint8_t*)malloc(sizeof(uint8_t) * size);
    cudaMalloc((void**)&d_pixels, sizeof(uint8_t) * size); // allocate device memory
    cudaMemcpy(d_pixels, pixels, sizeof(uint8_t) * size, cudaMemcpyHostToDevice); // assign device memory
    int paletteSize = (palette[0] << 16) | (palette[1] << 8) | palette[2];
    cudaMalloc((void**)&d_palette, 3 * sizeof(uint8_t) * (paletteSize + 1));
    cudaMemcpy(d_palette, palette, 3 * sizeof(uint8_t) * (paletteSize + 1), cudaMemcpyHostToDevice);



    // LINK ERROR IN THIS FUNCTION
    generateJulia << < 1024, 256 >> > (d_pixels, maxIterations, zoom, xCoord, yCoord, realC, imagC, width, height, d_palette);




    cudaMemcpy(pixels, d_pixels, sizeof(uint8_t) * size, cudaMemcpyDeviceToHost); // recover device memory
    std::vector<sf::Uint8> pixelVec(pixels, pixels + size);
    sf::Image image;
    image.create(width, height, pixelVec.data());
    free(pixels);
    cudaFree(d_palette);
    cudaFree(d_pixels);
    return image;
}







void gameLoopJulia(int width, int height, bool fullscreen) {
    // executes loadJulia() with interactive features
}
// Julia.h

#ifndef JULIA_FUNCTIONS_H
#define JULIA_FUNCTIONS_H


void gameLoopJulia(int width, int height, bool fullscreen);

#endif
//Palettes.cuh
#pragma once
#include "cuda_runtime.h"
#include <vector>
#include "Global.h"
#include "Palette.h"

#define PaletteFuncCycle 0


__device__ static Colour cyclePaletteFunction(int iterations, int maxIterations, uint8_t* palette) {
	int size = (palette[0] << 16) | (palette[1] << 8) | palette[2];
	if (iterations < maxIterations) {
		int index = iterations % (size) * 3 + 3;
		return { palette[index], palette[index + 1], palette[index + 2] };
	}
	return { 0, 0, 0 };
}

#ifndef PALETTEFUNCGUARD
#define PALETTEFUNCGUARD
__device__ Colour paletteFunc(int iterations, int maxIterations, uint8_t* palette, int code) {
	switch (code) {
	case PaletteFuncCycle:
		return cyclePaletteFunction(iterations, maxIterations, palette);
	}
}
#endif
// Global.h
#pragma once
struct Colour {
    uint8_t r, g, b;
};

I’m sorry if this was poorly explained, how do i fix this?

I just solved this on my own, unexpectedly when i make paletteFunc() inline the error goes away?