错误的LNK2019使用库中的makefile配置类型

发布于 2025-02-10 00:54:31 字数 898 浏览 0 评论 0 原文

我正在研究A makefile config类型。首先,我ran nmake 命令认为它可能会告诉我文件在哪里,但是我有一个错误: nmake:致命错误u1064:找不到makefile且未找到目标> ,我认为没有一个,我必须做到这一点。因此,我制作了一个文件并将其命名为 makefile ,在内部我只添加了一行 jnilib = c:\ program Files \ java \ jdk1.8.0_333 \ lib \ lib \ jvm.lib 我以为我需要。之后,我再次运行 nmake ,只有这次我回来了:

Microsoft (R) Program Maintenance Utility Version 14.29.30141.0
Copyright (C) Microsoft Corporation.  All rights reserved.

但是问题仍然存在,那是错误lnk2019未解决的外部符号。这意味着我做错了什么,但是老实说,我不知道如何使用 makefile 清楚地显示出来(也许我需要在文件中添加更多,或者我写的错误是错误的) 。

谁能帮我克服这个错误?那是我唯一的问题,如何告诉它我正在从该位置使用该库。

I was working on a tutorial project I found on another website where it explains how to use Java inside a C++ project (this is just for context, isn't the important part). The project was working as it should. After that I wanted to copy the code to another project, but this time it was of Makefile config type. First I ran nmake command thinking that it might tell me where the file is, but I got an error instead: NMAKE : fatal error U1064: MAKEFILE not found and no target specified, which I thought that there isn't one, and I have to make it. So I made a file and named it Makefile and inside I added only one line JNILIB=C:\Program Files\Java\jdk1.8.0_333\lib\jvm.lib that I thought I need. After that I ran nmake again, only this time I got back:

Microsoft (R) Program Maintenance Utility Version 14.29.30141.0
Copyright (C) Microsoft Corporation.  All rights reserved.

But the problem still persists and that is Error LNK2019 unresolved external symbol. This means I'm doing something wrong, but to be honest I don't know how to use Makefile which clearly shows (maybe I need to add more to the file, or what I wrote is wrong).

Can anyone help me get past this error? That is the only problem I have, how to tell it that I'm using that library from that location.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一念一轮回 2025-02-17 00:54:31

我不熟悉使用 nmake 。以下是我进行的测试,将DLL与CPP相同的目录。

makefile:

foo: main.cpp
  cl main.cpp TestDll.lib

I am not familiar with using nmake. Below is a test I did, putting the DLL in the same directory as cpp.

makefile:

foo: main.cpp
  cl main.cpp TestDll.lib
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文