首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是什么导致我得到链接器错误LNK2019?

是什么导致我得到链接器错误LNK2019?
EN

Stack Overflow用户
提问于 2015-12-04 07:31:55
回答 1查看 283关注 0票数 0

我试图在不同的时间点编写一个计算球高度的程序,但是每当我试图编译时,我都会得到错误的LNK2019。而且,它一直告诉我,我的双打将转换为国家统计局,但我不知道为什么。

1可能丢失的data 1>c:\users\oliver\documents\visual studio 2015\projects\parabola\parabola\parabola.cpp(22):警告C4244:‘1>c:\users\oliver\documents\visual’:从'double‘到'int’的转换,可能丢失的data 1>c:\users\oliver\documents\visual studio C4244警告C4244:‘参数’:从'double‘到'int’的转换,可能丢失的data 1>c:\users\oliver\documents\visual studio 2015\projects\parabola\parabola\parabola.cpp(24):警告C4244:‘1>c:\users\oliver\documents\visual’:从'double‘到'int’的转换,可能丢失的data 1>c:\users\oliver\documents\visual studio C4244警告C4244:‘参数’:从'double‘到'int’的转换,可能丢失的data 1>c:\users\oliver\documents\visual studio 2015\projects\parabola\parabola\constants.h(2):警告C4244:“参数”:从“double”到“int”的转换,可能丢失的数据1> Functions.cpp 1>c:\users\oliver\documents\visual studio C4244警告C4244:“初始化”:从“双”到“int”的转换,可能丢失的数据1>生成代码.1>Parabola.obj : error LNK2019:未解决的外部符号"double __cdecl ballHeight(int,double)“(?ballHeight@@YANHN@Z)在函数_main 1>C:\Users\OLIVER\Documents\Visual Studio 2015\Projects\Parabola\Debug\Parabola.exe :致命错误LNK1120: 1未解决的外部构建:0成功,1失败,0最新的0跳==========中引用。

这是所有的文件。

Main

代码语言:javascript
复制
#include "stdafx.h"
#include <iostream>
#include "FUNCTIONS.h"
#include "CONSTANTS.h"



int main()
{
using namespace std;

cout << "Enter the height of a building (in metres) you wish to simulate dropping a ball off of." << endl;
double bHeight = getHeight(); //Building height is defined


ballHeight(bHeight, 0); //Calls the function ballHeight at various points in time
ballHeight(bHeight, 1);
ballHeight(bHeight, 2);
ballHeight(bHeight, 3);
ballHeight(bHeight, 4);
ballHeight(bHeight, 5);

return 0;
}

函数

代码语言:javascript
复制
#include "stdafx.h"
#include <iostream>
#include "CONSTANTS.h"
#include "FUNCTIONS.h"

double getHeight() 
{
    using namespace std;
    double x = 0;
    cin >> x;
    return x;
}

double ballHeight(double bHeight, int seconds)
{
    using namespace std;

    double currentHeight = bHeight - gConstant * seconds * seconds / 2; //Calculates current ball height.

    cout << "At " << seconds << " seconds, the ball is at height: " << currentHeight << " metres." << endl; //Returns the ball height.
    return 0;
}

FUNCTIONS.h

代码语言:javascript
复制
#pragma once
#include "stdafx.h"
int main();
double getHeight();
double ballHeight(int seconds, double bHeight);
void tryAgain();

CONSTANTS.h

代码语言:javascript
复制
#pragma once
const int gConstant = 9.8;
EN

回答 1

Stack Overflow用户

发布于 2015-12-04 07:35:50

代码语言:javascript
复制
double ballHeight(double bHeight, int seconds)

代码语言:javascript
复制
double ballHeight(int seconds, double bHeight)

签名是不同的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34083116

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档