Bahareh
Bahareh

Reputation: 55

fatal error LNK1104

When I compile my code in visual studio c++ 2008 I get the following error:

fatal error LNK1104: cannot open file 'C:\Users\...\Documents\Visual Studio         
2008\Projects\...\Debug\....exe

I just copied my code from another project in visual studio C++ and pasted it in this project again in VS C++. Can it cause this error?

Upvotes: 6

Views: 25202

Answers (5)

Igor Telepenko
Igor Telepenko

Reputation: 1

I had the same problem (I don't say that this is exactly your case, but still) and it was quite strange because when I changed the code a bit everything worked normally... And I just found out that my antivirus blocked the .exe file as a possible threat (idk, mb it didn't like how I worked with memory by my C++ program). So, the source of LNK1104 can also be the antivirus.

Upvotes: 0

mBardos
mBardos

Reputation: 3067

In my case it was caused by the "Incremental Linking" option of the projects (Visual Studio 2015). Maybe because the files were also dependencies of other projects from the same solution, not sure...

Upvotes: 1

Henry
Henry

Reputation: 21

This can happen if you have turned on preprocessor output, e.g. in Properties | C/C++ | Preprocessor | Preprocess to a File == YES. Creating a preprocessor output file (of file type .i) is mutually exclusive to creating an object file (of time .obj).

Upvotes: 2

ivy
ivy

Reputation: 31

open TASK MANAGER and see if the process of the .exe is running in background even after closing it. if yes, then kill the process and then try to run it again.

Upvotes: 2

Puppy
Puppy

Reputation: 146900

This can happen because, for example, the executable is currently executing or opened by another program, or because you don't have the right permissions for that directory.

Upvotes: 7

Related Questions