错误LNK2019,如何解决此问题*更新*
Error LNK2019, how do I solve this? *update*
查看下面的评论以获取更新
这是错误报告:Cube_Life.obj:错误LNK2019:未解析的外部符号"void __cdecl Draw_Cordinates(void)"
请不要告诉我搜索,我已经搜索了,但找不到解决方案。我有一个Help_Functions.h和一个Help-Functions.cpp,它们的内容如下所示。
我在.h文件中声明了函数Draw_Cordinates,并在.cpp中定义了它,但我仍然会不断地得到错误。即使右键单击函数并选择显示定义,它也只显示搜索结果,无法找到定义。
我甚至尝试了一个简单的函数,比如void test(){return;},但仍然存在同样的问题。它们也没有被排除在构建之外。
Help_Functions.h
#pragma once
#include "stdafx.h"
void test();
void Draw_Coordinates();
Help_Functions.pp:
#include "stdafx.h"
void test(){return;}
void Draw_Coordinates()
{
//definition, it would be unnecessary to put all that code
}
stdafx.h:
#pragma once
#define PI 3.14159265359
#include "targetver.h"
#include <fstream>
#include <sstream>
#include <string>
#include <stdio.h>
#include <tchar.h>
#include <math.h>
#include <windows.h> // Standard Header For Most Programs
#include <gl/gl.h> // The GL Header File
#include <GL/glu.h>
#include <gl/glut.h> // The GL Utility Toolkit (Glut) Header
#include <stdlib.h>
#include <iostream>
#include "OBJECT_3D.h"
#include "Help_Functions.h"
using namespace std;
奇怪的是OBJECT_3D没有引起任何问题。我能想到的唯一区别是,它的文件是由Visual Studio创建的,但Help_Functions是由我单独创建的。
首先,如果您还没有这样做,请尝试在头文件中放置包含保护。
#ifndef HEADERNAME_H
#define HEADERNAME_H
// Code here
#endif
其次,在visualstudio中查看您的属性表。属性->链接器->输入。
确保所有的libs都包含正确。
下一步,在您验证所有库文件是否正确后,请在属性页中检查"VC++目录"。
错误似乎也可能在Help_Functions.h文件中。你最近做的事情可能会导致这个错误吗?如果您可以发布Help_Functions.pp/h。
相关文章:
- Project Euler问题4的错误解决方案
- 在java中解决这段代码时面临循环中的问题
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 难以理解某些人解决IOI问题的源代码
- 节俭并发:未解决的外部问题
- IpOpt拒绝解决不受约束的问题
- 如何解决这个超硬恒星的创造问题
- 循环无限运行C++解决骑士之旅问题
- 使用 bfs 解决连接组件问题时得到错误的答案
- 如何解决 Ninja c++ 构建和执行问题
- 无法在问题解决方案中执行输出逻辑
- 如何在不到O(N)的时间内解决这个问题?
- Arduino 用于语句错误。令牌之前的预期')' ';'。如何解决这个问题?
- 移动赋值运算符;尝试引用已删除的函数.我该如何解决这个问题?
- 如何在不使用额外空间的情况下解决这个问题?
- 我无法在Visual Studio代码中使用CIN输入答案,它说输入您的年龄,但它说只读文本编辑器如何解决这个问题?
- 最大的回文产品 - 程序未运行,编写解决方案但无法理解问题
- 如何解决"no Qt platform plugin could be initialized"问题?
- 如何解决可能的唯一组合问题
- Windows上的模板有什么问题?解决方案是什么