Stupid questions with LNK2001/LNK2019 #177
-
I wrote a static library that referenced bit7z, and then I wrote a console application that referenced my static library for testing. I'm getting a lot of LNK2001/LNK2019 errors when compiling my test program, and I don't know where the problem is and how to fix it. I searched the web for a long time and couldn't find any clues. (I hope you can forgive me if this question is stupid because I just started learning C++ code) I feel very strange. Because both projects (static library and test program) were written on my laptop, they could compile and run normally without encountering any errors. When I copied the entire project folder to another computer, the static library could still be compiled, but the test program could not be compiled. The In my static library, I follow these steps to reference the bit7z library:
In my test program, I follow these steps to reference my static library:
Is there anything wrong with the way I'm referencing the static library? In fact, I am not very familiar with how to write static/dynamic libraries and how to reference other people's static/dynamic libraries. I have tried hard to follow the tutorials on the Internet (especially the tutorials on Thank you for taking the time to reply to me, I will be very grateful for any reply! (I'm sorry that the screenshot from Visual Studio is in Chinese, because this computer must be used offline so I can't install the English language pack) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
Hi!
As far as I know, what you described seems the correct way! From the error messages, there seems to be some linking issue with the One thing to ensure when manually linking bit7z is to define the same set of Also, make sure to use the same MSVC's Anyway, I'll keep trying to replicate the issue! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
So far, I have tried using the However, I didn't mention that if I use my own compiled bit7z (currently compiled with v143), I encounter more But there is good news: using Strangely, with the same Visual Studio 2017 (v141), my laptop (Windows in a virtual machine) can compile bit7z, but my PC cannot, but I'm not using the exact same version of Visual Studio 2017, even the startup interfaces are different. I really appreciate all your efforts in trying to solve this problem! This issue has been very troublesome for me, and I'm sure it must be frustrating for you as well. Regardless of whether this problem is ultimately resolved, I will be grateful for your help! At the end, I'm attaching the output information from compiling bit7z and my library. bit7z-404-VS2022.txt |
Beta Was this translation helpful? Give feedback.
Hey, sorry for the late reply!
First of all, thank you for all the details; they really helped me better understand the issue!
Yeah, the issue there is the difference between v143 and v141 that makes the compilation fail!