Thread: Don't known error

  1. #1
    Registered User
    Join Date
    Mar 2008
    Location
    Sant Feliu de Codines - Barcelona - Catalunya
    Posts
    2

    Unknown error [it was:Don't known error] (sorry)

    Hi, I'm programming and I don't really see what's my error at this code:
    Code:
    #ifndef H_ELEMENT_SOCI
    #define H_ELEMENT_SOCI
    
    
    struct sSoci
    {
    	char dni[15];
    	char nom[40];
    	char edat[3];
    	char altres[20];
    };
    
    typedef struct sSoci* Soci;	
    
    //Creem un nou element
    Soci elementsoci_buit();
    
    
    #endif
    if I compile, it's says this:

    ElementSocis.h:13: error: storage class specified for parameter ‘Soci’

    Anyone can help me??

    Thank you very much!

    Pau.

    PD. Sorry for my bad english...
    Last edited by pauibars; 03-20-2008 at 06:43 PM.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    I can't see anything obviously wrong with this code (although you should use (void), not (), if you mean no parameters for your function).

    I'm guessing you've got a bug elsewhere that's being triggered here. Probably something in your .c file that you're doing before you include this header--either in the .c file itself or in another header that's being included beforehand.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    probably missing ; in the header included before this header
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Typedefing struct sSoci* to Soci is just asking for trouble.
    The best thing is to just typedef sSoci to Soci and use Soci* everywhere, so that it is known that it is a Soci pointer.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    Quote Originally Posted by Elysia View Post
    Typedefing struct sSoci* to Soci is just asking for trouble.
    The best thing is to just typedef sSoci to Soci and use Soci* everywhere, so that it is known that it is a Soci pointer.
    Exactly my thoughts

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM