アプリ版:「スタンプのみでお礼する」機能のリリースについて

C言語の勉強をしているものです。
すみません、助けてください。
環境はwindows10 visual studio10です。

エラーの表示
LNK1120 1件の未解消の外部参照
LNK2019 未解決の外部シンボル_straidが関数_initで参照されました。

main.cのファイル
#include"logic.h"
#include"showResult.h"
#include<stdio.h>

void main(){
int num;
init();
printf("じゃんけんゲーム\n");
printf("0:グー、1:チョキ、2:パー\n");
while(1){
printf("あなたの手は?(0-2):");
scanf_s("%d", &num);
if(num<0||num>2){
printf("終了します\n");
break;
}
else {
setPlayer(num);
setComputer();
Judge();
}
}
}

logic.hのファイル
#ifndef _LOGIC_H_
#define _LOGIC_H_

void init();
void setPlayer(int);
void setComputer();

#endif // _LOGIC_H_

logic.cのファイル
#include"logic.h"
#include<stdlib.h>
#include<time.h>

int player, computer;


void init() {
strand((unsigned)time(NULL));
}

void setPlayer(int num){
player = num;
}

void setComputer() {
computer = rand() % 3;
}




showResult.hのファイル
#ifndef _SHOWRESULT_H_
#define _SHOWRESULT_H_

void Judge();

#endif // _SHOWRESULT_H_




showResult.cのファイル
#include"showResult.h"
#include<stdio.h>

extern int player, computer;
char results[3][16] = { "グー","チョキ","パー" };

void Judge() {
printf("プレイヤー:%s\n", results[player]);
printf("コンピューター:%s\n", results[computer]);
if ((player == 0 && computer == 1)
|| (player == 1 && computer == 2)
|| (player == 2 && computer == 0)) {
printf("プレイヤーの勝ち\n");
}
else if((player==1&&computer==0)
||(player==2&&computer==1)
||(player==0&&computer==2)){
printf("コンピューターの勝ち\n");
}
else
{
printf("あいこです。\n");
}
}

A 回答 (1件)

>>LNK1120 1件の未解消の外部参照


LNK2019 未解決の外部シンボル_straidが関数_initで参照されました。

エラー原因は、上記のエラーメッセージが示してくれています。
未解決のstraid関数がどこかにあるのでしょうから、それがソースであるなら、いっしょにコンパイル、ライブラリにあるなら、それをリンクしてあげてください。
    • good
    • 0
この回答へのお礼

できました、ありがとうございます。

お礼日時:2017/11/15 22:47

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!