Jeanine already suggested that an antivirus or other
security program may be blocking it. She also suggested
that you set your directory as an exclusion in any AV/AM
software you re running. Have you tried that?
As further exploration along these lines, provide the
following info:
(1) What AV/AM/IS software are you using?
(2) Have you tried executing your program with
the security software temporarily disabled?
Some security software can be very aggressive when
analyzing unknown programs. As a result they sometimes
trigger a false positive - identifying the program
as possibly malicious when it isn't. When it does
that it may block access to the file in question.
I have seen this happen a number of times with very
small sample programs that I was building. When the
program was altered by adding or changing code, the
false positive detection disappeared.
When you change the string in your program you change
the object code that is generated, and that may lead to
a different assessment of the exe by the security software.
In addition to testing with your security software
briefly turned off, also experiment with the string
that appears to be creating issues while adding
some additional code to the source. Even if it
isn't needed for the sample itself. For example:
#include<iostream>
using namespace std;
int main()
int dummy[10] = {0};
char str[] = "This is a sample string";
return 0;
Or try this variation which uses a read-only
string instead of the array in your example:
#include<iostream>
using namespace std;
int main()
//char str[] = "This is a sample string";
const char *str = "This is a sample string";
return 0;
Wayne
First of all, you could check if your application is already running. If so, you could try to stop the program and unload it from the debugger before building it again. If the app is open in another program, such as a resource editor, close it. If your program is unresponsive, you may need to use Task Manager to end the process. You might also need to close and restart Visual Studio.
And some antivirus programs may temporarily block access to newly created files, especially .exe and .dll executable files. To fix this issue, try excluding your project build directories from the antivirus scanner.
For more details I suggest you could refer to the Doc: Linker Tools Error LNK1104
Best Regards,
Jeanine
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Thank you for your answer,
I restarted Windows but this problem has not been solved.
I have a problem with this piece of code. if I change my code, I can run the program.
For example:
anonymous userrvan360-6172
Unfortunately, I couldn't reproduce your issue on my PC.
I suggest you could rebuild a project to see if it can run successfully. And I suggest you could try to clear the VS cache(Please close every VS instances and go to this path: “C:\Users[username]\AppData\Local\Microsoft\VisualStudio\16.0_XXXX” and rename or delete every "ComponentModelCache" folders). You also could try to update VS to the latest version or repair VS.