Thread: Undefined symbol when moving (unrelated) variable from source to header

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    278
    Code:
    /* menus.h */
    ...
    menuOPS op_splash = {4, { "string1" , "string2" , "string3" , "string4" } };
    ...
    You generally should NOT do this (declare a variable) in a header. If you do, you will potentially create multiple copies of the same variable (one in each .c file that includes menus.h in this case)

    I'm not sure you showed enough of the code to generate the error you are seeing. Why not create the minimum set of files that does and provide these? Don't make us guess.
    Last edited by mike65535; 04-18-2011 at 11:55 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. undefined symbol: wurfl_ismobile
    By retrodans in forum C Programming
    Replies: 3
    Last Post: 03-30-2011, 11:46 AM
  2. fseek() changing an unrelated variable?
    By aaronvegh in forum C Programming
    Replies: 3
    Last Post: 11-21-2007, 02:30 PM
  3. Undefined symbol error??
    By Jedijacob in forum C Programming
    Replies: 10
    Last Post: 03-18-2005, 04:46 PM
  4. undefined symbol
    By sworc66 in forum C Programming
    Replies: 3
    Last Post: 09-10-2003, 06:29 AM
  5. Undefined symbol 'stdprn'
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-03-2002, 02:05 PM

Tags for this Thread