Dec 29, 2018 at 11:08am UTC
Hello everyone.My program was working but suddenly after i just changed some numbers it started to fail with error link1168
This window pops out
1 2 3 4 5 6 7 8 9 10
_CRT_SECURITYCRITICAL_ATTRIBUTE
void __CRTDECL operator delete (void * const block) noexcept
{
#ifdef _DEBUG
_free_dbg(block, _UNKNOWN_BLOCK);// Exception thrown at 0x0F89D9CB (ucrtbased.dll) in Projekat4.exe: 0xC0000005: Access violation reading location 0xDDDDDDCD.
r
#else
free(block);
#endif
}
Where can the error possibly be?
This is main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include<iostream>
#include"Workflow.h"
#include"Activity.h"
#include"State.h"
void main()
{
srand(time(NULL));
Step **n=new Step*[1009];
Step **k = new Step*[1009];
Workflow *W1 = new Workflow(20);
W1->Definisi("Activity" , 10);
W1->Definisi("State" , 10);
n = W1->GetSpecificSteps("Activity" );
k = W1->GetSpecificSteps("State" );
W1->InsertAt(12,"Activity" );
W1->RemoveAt(18);
Workflow *W3 = new Workflow(1009);
Workflow *W4 = new Workflow(1000);
Workflow *W2 = W4;
cout << *W1;
delete []n;
delete []k;
delete W1; //dolazi do neke greske u programu
delete W3;
delete W4;
delete W2;
system("pause" );
}
Last edited on Dec 29, 2018 at 11:10am UTC
Dec 29, 2018 at 11:15am UTC
Read the error:
cannot open filename.exe for writing
Read it again:
cannot open filename.exe for writing
Do you understand what this says?
I expect that you're still running the executable. You have to close it before you can write over it. Other possible problems include not having permission to write to disk, and disk errors.
This is not a problem with your source code. You need to actually READ the error messages.
Dec 29, 2018 at 11:36am UTC
I have closed all my windows with visual studio and executable windows but still doesn't work.I don't think I had this message earlier.
Dec 29, 2018 at 4:13pm UTC
Hello Zivojin,
Your error is about not being able to write to the file . But where is the code that opens the file and writes to it?
Your problem may start in "main", but that is not likely where it is.
Post the code that opens the file and where it writes to the file.
Hope that helps,
Andy