Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
所有的功能和结构都会提高“;隐式声明<;功能>&引用;在main.c中使用时出现错误/警告_C_Ansi - Fatal编程技术网

所有的功能和结构都会提高“;隐式声明<;功能>&引用;在main.c中使用时出现错误/警告

所有的功能和结构都会提高“;隐式声明<;功能>&引用;在main.c中使用时出现错误/警告,c,ansi,C,Ansi,已引发的错误: ; 我的主要意见是: #include "bow.h" int main(){ struct word_count_struct *CS; char *sentence = "#The quick brown fox jumped over 23&%^24 the lazy dogs."; /* test sentence */ char *word; /* pointer to a word */ pr

已引发的错误: ;

我的主要意见是:

#include "bow.h"


    int main(){
        struct word_count_struct *CS;
      char *sentence = "#The quick brown fox jumped over 23&%^24 the lazy dogs."; /* test sentence */
      char *word;  /* pointer to a word */

      printf( "sentence = \"%s\"\n", sentence );  /* show the sentence */

      while (*sentence)  /* while sentence doesn't point to the '\0' character at the end of the string */
      {
        word = get_word( &sentence );  /* this will allocate memory for a word */
        printf( "word = \"%s\"; sentence = \"%s\"\n", word, sentence );  /* print out to see what's happening */
        CS = new_word_count(word);
        printf("Word in word_count_struct = %s\n",CS->word);

        free(word);  /* free the memory that was allocated in get_word */
      }



    return 0;
我的bow.h(bow.c)包含所有:

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>

#ifdef BOW_H
#define BOW_H


struct word_count_struct 
{
    char *word;
    int count;
};

struct bag_struct 
{
    struct word_count_struct *bag;
    int bag_size;
    int total_words;
};

/* More functions */

#endif
我完全不知道是什么导致了这些错误,如果您能提供任何帮助,我们将不胜感激。

您的
\ifdef BOW\u H
未定义,因此标题基本为空。请更改为
\ifndef

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>

#ifdef BOW_H
#define BOW_H


struct word_count_struct 
{
    char *word;
    int count;
};

struct bag_struct 
{
    struct word_count_struct *bag;
    int bag_size;
    int total_words;
};

/* More functions */

#endif
bag: main.o bow.o bow.h
        gcc -Wall -ansi -pedantic main.o bow.o -o bag

bow.o: bow.c bow.h
        gcc -Wall -ansi -pedantic -c bow.c -o bow.o

main.o: main.c bow.h
        gcc -Wall -ansi -pedantic -c main.c -o main.o


clean:
        rm -i bag bow.o main.o