Thread: Help with linking fiels for game

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    124

    Help with linking fiels for game

    Im having a problem with my linking constantly with getting double the
    intialize items then i requested , but thou i did use comma guides and pragma once....

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You've got initialisations inside header files, like
    bool GAMESTARTED=false; //used by NewBlock()

    In the header, you should have
    extern bool GAMESTARTED;

    In exactly ONE .cpp file, you should have
    bool GAMESTARTED=false; //used by NewBlock()

    In header files,
    - structs and classes
    - extern data
    - const data (as you have it now)
    - function prototypes
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems linking with g++
    By Just in forum Linux Programming
    Replies: 11
    Last Post: 07-24-2006, 01:35 AM
  2. strange linking error -- can not find shared library
    By George2 in forum C Programming
    Replies: 2
    Last Post: 07-10-2006, 10:51 PM
  3. Replies: 8
    Last Post: 04-27-2006, 10:39 AM
  4. Grrr.... SDL Linking Problem
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-12-2005, 08:44 PM
  5. Linking error with DirectDrawCreateEx
    By jjj93421 in forum Game Programming
    Replies: 6
    Last Post: 04-06-2004, 03:57 PM