already defined in main.obj error C
Hi I have a simple SDL application and I'm getting error that all variables in main.h are already defined. I don't see where I'm defining them twice. main.h : #pragma once #include <stdio.h> #include <SDL.h> #include <SDL_image.h> const char title[] = "game"; int windowWidth = 800; int windowHeight = 600; int isRunning = 0; SDL_Window* window = NULL; Uint32 render_flags = NULL; SDL_Renderer* renderer = NULL; main.c: #include "textures.h" int main() { if (SDL_Init(SDL_INIT_EVERYTHING) == 0) { printf("SDL initialized successfully\n"); } else { printf("SDL INIT ERROR"); SDL_Quit(); return -1; } window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, 0); if (window) { printf("SDL Window created successfully\n"); } else { printf("ERROR creating window"); SDL_DestroyWindow(window); SDL_Quit(); return -1; } render_flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC; renderer = SDL_CreateRenderer(window, -1, render_flags); if (renderer != 0) { printf("SDL Renderer created successfully\n"); } else { printf("ERROR creating renderer"); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); return 0; } isRunning = 1; // MAIN LOOP SDL_RenderClear(renderer); SDL_RenderCopy(renderer, tex, NULL, NULL); SDL_RenderPresent(renderer); SDL_Delay(5000); // clean up resources before exiting SDL_DestroyTexture(tex); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); return 0; } textures.h: #include "main.h" SDL_Surface* surface = NULL; SDL_Texture* tex = NULL; void LoadTextures(); textures.c: #include "textures.h" void LoadTextures() { surface = IMG_Load("test.png"); tex = SDL_CreateTextureFromSurface(renderer, surface); SDL_FreeSurface(surface); }