Don't known error

This is a discussion on Don't known error within the C Programming forums, part of the General Programming Boards category; 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 ...

  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 07:43 PM.

  2. #2
    cas
    cas is offline
    Registered User
    Join Date
    Sep 2007
    Posts
    993
    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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    probably missing ; in the header included before this header
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,033
    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, 09:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 10:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 02: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21