Thread: extern enum

  1. #1
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265

    extern enum

    I declared an enum as a type in an header file and I want to use it in my .c file, should I use extern?

    .h
    Code:
    typedef enum {BLA, BLABLA, BLABLABL} MY_TYPE;
    In the .c file the compiler doesn't recognize MY_TYPE.

    Thanks (:
    gavra.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Include that header in that source file.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    I did. But it doesn't work..
    gavra.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Post the smallest and simplest program that demonstrates the problem, and also post the error message(s), if any.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    Oh ........, never mind I'm an idiot XD
    I mixed C++ in the .c file V_V
    Thanks anyway (:
    gavra.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. extern classes
    By Swordsman in forum C++ Programming
    Replies: 1
    Last Post: 05-07-2008, 02:07 AM
  2. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  3. extern with enum
    By penney in forum C Programming
    Replies: 4
    Last Post: 10-22-2003, 12:38 PM
  4. Extern Question, really confused
    By SourceCode in forum C Programming
    Replies: 10
    Last Post: 03-26-2003, 11:11 PM
  5. extern symbols, what do these mean exactly?
    By Shadow12345 in forum C++ Programming
    Replies: 8
    Last Post: 11-02-2002, 03:14 PM