Thread: storage class specified for parameter

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    913

    storage class specified for parameter

    im getting "storage class specified for parameter" from gcc, what does it mean?

    it points to these lines:

    Code:
    int replacestring(char *src, char search[], char replace[]);
    int replaceallstrings(char *src, char search[], char replace[]);
    int replacechar(char *src, int search, int replace);
    int replaceallchars(char *src, int search, int replace);
    here the rest of the code.
    Code:
    int replacestring(char *src, char search[], char replace[]) {
    	char *spot = strstr(src, search);
    	char *data = NULL;
    
    	if(spot != NULL) {
        		data = malloc( strlen(spot) + 1 );
        		strcpy(data, spot);
    
        		*spot = '\0';
        		strcat(src, replace);
    
            	spot = &data[strlen(search)];
        		strcat(src, spot);
    	} else
        		return 1;
    
    	return 0;
    }
    
    int replaceallstrings(char *src, char search[], char replace[]) {
    	while( replacestring(src, search, replace) == 0 )
        		;;
    
    	return 0;
    }
    
    int replacechar(char *src, int search, int replace) {
    	char *spot = strchr(src, search);
    
    	if(spot != NULL)
        		*spot = replace;
    	else
        		return 1;
    
    	return 0;
    }
    
    int replaceallchars(char *src, int search, int replace) {
    	while( replacechar(src, search, replace) == 0 )
        		;;
    
    	return 0;
    }

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    i have str_replace.c and str_replace.h. in a seperate file called html.c str_replace.h is included in it.

    when i compiled str_replace.c by its self the only error i get is that there is no main.

    i did run "gcc -E html.c > prog.i", im not sure what to do with prog.i, it looks ok to me but this is the first time i ever used the -E flag.

    can any one take a look at it?

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    You're including .c files inside .h files - this is bad.
    i thought headers werent supposed to have any code in them? how do they accomplsih anything if they dont include a source file?

    That 'extern int search' is the cause of the problem
    i dont see whats the matter with that, arent headers supposed to have externs? i want to use the functions outside of that source file so doesnt it have to be extern-ed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help on class coupling
    By andrea72 in forum C++ Programming
    Replies: 4
    Last Post: 04-17-2011, 10:16 AM
  2. Replies: 3
    Last Post: 07-08-2008, 10:01 AM
  3. Replies: 5
    Last Post: 07-17-2006, 03:13 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM