问题标签 [lnk2019]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
2449 浏览

c++ - C++ : error LNK2019: unresolved external symbol

Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?

So I have compared my issue to the vast library of problems that have spawned from this category on this site. I still have no clue as to why my compiler is complaining.

So let me give a short briefing on what it is I want to do with my program. I am researching elevator algorithms. I want to implement priority queues using a binary heap.

I have got the source code from mark allen wiess website. For the heaps.

I am constructing my own reqnode class that represents the nodes of the binary tree.

reqnode = request node.

The scenario is: A user makes a request. I service the request. I am working with multiple requests. Thus I have to use a priority, on which user to satisfy first.

This is my header file for my binary heap.

These are the functions defined for my binary heap.

This is my header file for reQnode

This is my driver implementation

Finally, These are the errors that haunt me!

I'm unsure of where to pinpoint this problem. I had a previous linker error. I resolved it. This one just seems like a doozy.

0 投票
1 回答
703 浏览

visual-studio-2010 - error LNK2019: unresolved external symbol - only .h files

Argh... I've been struggling lately to make Visual Studio 2010 (VC++) include a bunch of 3rd party libraries I wanna use in my project. That's the issue: The linker seems not to be able to determine every symbol that is generated in my code which come from the 3rd party libraries definitions. I've included the header files path on my include directories and also the sources path on my source directory, but it is still not working. I've googled it for a while and in most of cases, the issues is cause by a missing reference of the .lib file on linker's additional dependencies, however the library don't come with them.

Here's a piece of sample code:

So that's the output VS shows

So i wonder if is there a way to build my sources with the .h and .cpp files of my 3rd party library. Thank you.

Caio

0 投票
1 回答
12483 浏览

c++ - 错误 LNK2019:未解析的外部符号“公共:无效 __thiscall

我的任务是编写代码来使用递归跟踪排序的链表。我们得到了类和文件的组成,但需要填写功能。我遇到了四个错误,我认为这些错误是由在公共函数中调用私有函数引起的。我的错误是:

我的代码:

节点.h

排序列表.h

排序列表.cpp

主文件

0 投票
2 回答
78105 浏览

c++ - 错误 LNK2019:未解析的外部符号

我最近再次开始使用 C++ 编程,出于教育目的,我正在开发一款扑克游戏。奇怪的是,我不断收到以下错误:

我对这个问题做了一些研究,大多数都指向标头中的构造函数和析构函数定义与 .cpp 不匹配。我没有看到标题和 .cpp 有任何问题。

这是 poker.h 的代码:

.cpp 中的代码:

0 投票
1 回答
1164 浏览

c++ - 无法打开套接字。C++

我正在尝试打开套接字。但它在 WASStartup、WSAGetLastError、socket、htons 处给出了一个链接错误(LNK2019:函数“function”中引用的未解析的外部符号“symbol”)。我做错了什么?

这是一个源代码

0 投票
1 回答
16271 浏览

dependencies - Visual Studio 2012 与静态库的链接错误

我最近从 2005 年升级到 2012 年(我很确定)并且在构建我的解决方案时遇到了链接错误。经过数小时的谷歌搜索和四处搜索后,我的想法已经耗尽。我已经建立了几十个项目,所以我很确定我做的一切都是正确的,但公平地说,已经有几年了。

因此,作为测试,我建立了一个新项目。我称它为 App,一个 Windows 应用程序 (.exe)。我创建了第二个名为 Core 的项目,并在其配置类型中将其标记为静态库 (.lib)。两者都是解决方案的一部分。在 Core 中,我添加了 Test.cpp 和 Test.h,其中包含一个小类,其中包含一个简单的功能。然后,在 Window 的应用程序 WinMain.cpp 文件中,我有 WinMain(),我通过 CTest 测试调用这个测试类;测试结果();

除此之外,我将项目 App 的 Project Dependencies 设置为 Core,并最终将 Test.cpp/.h 所在的 Core 代码的路径添加到 App 的 Additional Include Directories 中。

我收到以下链接错误,我终生无法弄清楚原因。有谁知道我可能错过了什么步骤或 2012 年与以前的版本相比有什么变化?非常感谢您的帮助!

0 投票
1 回答
104 浏览

c++ - GLUT 游戏中的 C++ LNK 2019 错误

为糟糕的问题标题道歉,我不知道如何问这个。我在尝试编译我的 GLUT 游戏时遇到 LNK2019 错误,我无法找出导致错误的原因。

错误: main.obj :error LNK2019: unresolved external symbol "public: void __thiscall asteroid::animateAsteroid(void)" (?animateAsteroid@asteroid@@QAEXXZ) referenced in function "void __cdecl idle(void)" (?idle@@YAXXZ)

小行星.h

asteroid.cpp(麻烦功能)

Main.cpp(我得到错误的函数)

对于解决此问题的任何帮助,我将不胜感激。

谢谢,丹。

0 投票
1 回答
1018 浏览

c++ - c++(构造函数)继承-LNK 2019错误

可能重复:
什么是未定义的引用/未解决的外部符号错误,我该如何解决?

我有一个涉及类 A 及其派生类 B的LNK 错误。更准确地说,我有这个编译错误

我猜这可能与继承构造函数的调用有关,或者与函数()或函数_bis()的某些调用中的签名无关。但是,我找不到这样的错误。

您对可能的解决方法有提示吗?这是(简化的)A和B的代码。

B.cpp

B.h

A.cpp

A.h

谢谢!

0 投票
2 回答
2148 浏览

c++ - LNK2019 在 QtCreator 中使用 WinMain 时

我正在 QtCreator 中制作一个 FLTK GUI。请不要因为我没有使用 Qt 来制作我的 GUI 而生我的气,这无关紧要。

无论如何,我的项目类型是“Plain C++ Project”,这是我的代码(你可能不需要阅读它,但我把它放在那里以防万一):

当我运行此程序时,我收到此警告和两个错误(抱歉,小图像,如果您看不懂,请放大浏览器):

在此处输入图像描述

我知道 LNK2019 错误是什么,事实上它们可能是我存在的祸根。但在这种情况下,我不知道为什么会得到这个。我认为你也应该看看这个,这是我的 Qt 项目 .pro 文件的文本:

模板 = 应用程序配置 += 控制台配置 -= app_bundle 配置 -= qt

win32: LIBS += -luser32 -lshell32 -lgdi32 -lole32 -ladvapi32

来源 += main.cpp

unix|win32: LIBS += -L$$PWD/../../../Desktop/C++/FLTK/lib/ -lfltk

INCLUDEPATH += $$PWD/../../../Desktop/C++/FLTK/include DEPENDPATH += $$PWD/../../../Desktop/C++/FLTK/include

这可能是最重要的部分:我从来没有遇到任何错误,当我使用 int main() 作为我的主函数时,程序运行良好。

所以,我的问题是为什么我会得到这个,我该如何解决?

0 投票
2 回答
267 浏览

c++ - 带有 LNK2019 错误的对象的 C++ 链表

基本上这是我的 C++ 分配项目,我对 C++ 很陌生,我遇到了这个错误。main == 中的注释代码也有错误不是匹配的操作数

1>Main2.obj : 错误 LNK2019: 无法解析的外部符号“class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class Customer &)” (??6@YAAAV?$basic_ostream@DU? $char_traits@D@std@@@std@@AAV01@AAVCustomer@@@Z) 在函数 "void __cdecl display(struct Node *)" (?display@@YAXPAUNode@@@Z) 中引用

这是代码 Main.cpp

客户.cpp

最后是customer.h