解析的外部符号 - 如何解决? [英] Unresolved External Symbol - How to fix?

查看:120
本文介绍了解析的外部符号 - 如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是pretty新的节目。我遇到了这个错误,我想不通。你应该能够把一个分数,它会使用为pre放数组中的信息,并告诉你,很多学生是如何得到该级。

错误味精我得到的是:

  1 GT; ------启动生成:项目:Ch11_27,配置:调试的Win32 ------
1>建立开始2013年4月4日下午一点17分26秒。
1> InitializeBuildStatus:
1>感人的调试\\ Ch11_27.unsuccessfulbuild。
1> ClCompile:
1> main.cpp中
1> main.obj:错误LNK2019:​​无法解析的外部符号无效__cdecl checkScore为(int * const的,为int * const的)(checkScore @@ YAXQAH0 @ Z?)在函数_main引用
1> F:\\ A学校的东西TJC 2013年春季\\介绍PROG \\ C ++项目\\ Ch11_27 \\调试\\ Ch11_27.exe:致命错误LNK1120:1无法解析的外部
1>
1>建立失效。

下面是我的code:

  // Advanced27.cpp  - 显示学生人数
//赚了具体比分
//创建/以&lt修订;你的名称>针对<当前日期>#包括LT&;&iostream的GT;
使用命名空间std;//函数原型
无效checkScore(INT得分[],int型存储[]);诠释的main()
{
    //声明数组
    INT得分[20] = {90,54,23,75,67,89,99,100,34,99,
                      97,76,73,72,56,73,72,20,86,99};
    int型存储[4] = {0};
    焦炭答案='';    COUT<< 你要检查一个档次(Y / N)?
    CIN>>回答;
    回答= TOUPPER(答案);    而(答案='Y')
    {
        checkScore(得分,储存);    COUT<< 你要检查一个档次(Y / N)?
    CIN>>回答;
    回答= TOUPPER(答案);    }
    系统(暂停);
    返回0;
主要功能} //结束// *****功能***** Defenitions
无效checkGrade(INT得分[],int型存储[])
{
    INT温度= 0;
    INT earnedScore = 0;    COUT<< 输入你想查询一个档次;
    CIN>> earnedScore;    对(INT子= 0;子&下; = 20;子+ = 1)
    {
        如果(得分[子] = earnedScore)
        {
            存储[临时] + = 1;        }
    }
}


解决方案

您函数 checkGrade()中的main()以下 - 功能或许应该被称为无效checkScore(INT得分[],int型存储[])

I'm pretty new to programming. I have run into this error that I can't figure out. You should be able to put in a score and it will use the information that is pre put in the array and tell you how many students got that grade.

The error msg I get is:

1>------ Build started: Project: Ch11_27, Configuration: Debug Win32 ------
1>Build started 4/4/2013 1:17:26 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\Ch11_27.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl checkScore(int * const,int * const)" (?checkScore@@YAXQAH0@Z) referenced in function _main
1>F:\a School Stuff TJC Spring 2013\Intro Prog\C++ Projects\Ch11_27\Debug\Ch11_27.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.

Here is my code:

//Advanced27.cpp - displays the number of students
//earning a specific score
//Created/revised by <your name> on <current date>

#include <iostream>
using namespace std;

//Function Prototypes
void checkScore( int scores[], int storage[]);

int main()
{
    //declare array
    int scores[20] = {90, 54, 23, 75, 67, 89, 99, 100, 34, 99, 
                      97, 76, 73, 72, 56, 73, 72, 20, 86, 99};
    int storage[4] = {0};
    char answer = ' ';

    cout << "Do you want to check a grade? (Y/N): ";
    cin >> answer;
    answer = toupper(answer);

    while (answer = 'Y')
    {
        checkScore(scores, storage);

    cout << "Do you want to check a grade? (Y/N): ";
    cin >> answer;
    answer = toupper(answer);

    }
    system("pause");
    return 0;
}   //end of main function

//*****Function Defenitions*****
void checkGrade(int scores[], int storage[])
{
    int temp = 0;
    int earnedScore = 0;

    cout << "Enter a grade you want to check: ";
    cin >> earnedScore;

    for (int sub = 0; sub <= 20; sub +=1)
    {
        if (scores[sub] = earnedScore)
        {
            storage[temp] += 1;

        }
    }
}

解决方案

Your function checkGrade() below the main()-function should probably be called void checkScore( int scores[], int storage[])

这篇关于解析的外部符号 - 如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆