遇难题了:程序连接时报 duplicate symbol错误
											小弟我学习写了一个程序,程序连接时报错。下面是详细代码和错误信息,求帮助。main.c
 程序代码:
程序代码:#include "store.h"
int main(){
    //1.初始化数据
    InIt();
    //2.打印这些数据
    ShowProps();
}store.c
 程序代码:
程序代码:#include "store.h"
void InIt(){
    static Prop propArray[] = {
        {1,"双倍经验卡",3000,10,"双击666"},
        {2,"腐烂的道袍",5000,8,"只可远观,不可亵玩"},
        {3,"生锈的铁剑",8000,10,"新后专用"},
        {4,"无极袍",13000,5,"刀枪不入,水火不浸"},
        {5,"直升一级丹",83000,10,"吃了以后还想在吃!在吃!在吃!"},
    };
    propsCount = sizeof(propArray) / sizeof(Prop);
    props = propArray;//设定指针的指向
    static Player playerArray[] = {
        {1,"超级毛毛虫","123456",.gold=50000,},
        {2,"塔罗奥特曼","123456",.gold=150000,},
        {3,"元始天尊之徒","123456",.gold=500000,},
        {4,"星河","123456",.gold=1150000,},
    };
    playerCount = sizeof(playerArray) / sizeof(Player);
    players = playerArray;
}        //初始化数据
void ShowProps(void){
    int i;
    if(props == NULL) return;
    printf("编号\t名称\t单价\t库存\t商品介绍\n");
    for(i = 0;i < propsCount;i++){
        printf("%d\t%s\t%.2lf\t%d\t%s\n",props[i].id,props[i].name,props[i].price,props[i].stock,props[i].desc);
    }
}//列出商城中道具信息
//void ShowPlayer(void);//列出玩家信息store.h
 程序代码:
程序代码:#ifndef store_h
#define store_h
#include <stdio.h>
#include <stdlib.h>
/*  商品结构体  */
typedef struct _prop{
    int id;
    char name[50];//名称
    double price;//单价
    int stock;//库存
    char desc[200];//描述
}Prop;
/*  背包结构体  */
typedef struct _bag{
    int playerId;//所属玩家编号
    int count;//当前背包中道具的数量
    int max;//当前背包格子总数
    Prop props[8];//当前背包中的道具数组
}Bag;
/*  玩家结构体  */
typedef struct _player{
    int id;         //玩家编号
    char name[50];  //玩家的昵称
    char pass[50];  //玩家的密码
    Bag bag;        //玩家的背包
    double gold;    //玩家金币
    double sysee;   //元宝数量
}Player;
/* 设置指针,方便访问初始化后的数据 */
Prop *props;
Player *players;
/* 定义道具和玩家总数量全局变量 */
int propsCount = 0;
int playerCount = 0;
void InIt();        //初始化数据
void ShowProps(void);//列出商城中道具信息
//void ShowPlayers(void);//列出玩家信息
#endif/* store_h */错误信息:
 程序代码:
程序代码:gcc -g main.o store.o -o main
duplicate symbol _propsCount in:
    main.o
    store.o
duplicate symbol _playerCount in:
    main.o
    store.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1										
					
	


 
											





 
	    

 
	



