Fix vs cannot open at compile time ... obj file issues

Source: Internet
Author: User

The previous time in the link itself to write a good dynamic library, according to the original method, but encountered the problem of failure, indicating what is missing what. obj file. On the internet to find a lot of methods, tried a lot, but all failed, feel very unreliable. Finally in the case of the desperate, finally solved, the following share my solution, hope can help Yimeimei.

Look at the link command line and you'll know.
Additional dependencies, input-and-linker, properties---
Here you will find that the "Additional dependencies" you set earlier have been rewritten by the IDE.
For example, you want to add a ABC.lib link library, the full path is "C:\Program files\abc.lib",
If overridden by the IDE, it becomes "C:\Program."

"Files\abc.lib"
The corresponding command line becomes link (...). "C:\Program"

"Files\abc.lib"
Then the linker will ask for "C:\Program.obj" file, because the file does not exist, so it will return the above debugging information ' link:fatal error LNK1104: Cannot open the file "C:\Program.obj"!

This is the reason: in the name of the folder, the folder name has a space, causing the editor to use this folder as two directories to explain ("The compiler is very stupid, many times, you think, he will not know")

The solution, in fact, is also very simple. is to say the whole path plus "".

For example:

For example, you set C:\Program Files\xxx\lib\xxx.lib, indicating that you are connected to this XXX.lib in the project, but there is a space between program and file, so it resolves to C:\Program, and then it appears: C:\Program.obj cannot be opened, so when you set it up as "C:\Program files\xxx\lib\xxx.lib", use "" "quotation marks to enclose the entire path. This way the compiler does not have ambiguity to explain the commands you originally wanted to set.

Fix vs cannot open at compile time ... obj file issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.