🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

LNK1168

Started by
7 comments, last by Endurion 3 years, 3 months ago

I get the following error whenever I change my code, it does not occur when I end task in the task manager. there has to be a work around to solve this problem. here is the error I get.

Error LNK1168 cannot open C:\Users\Owner\source\repos\DX9Tut\Debug\DX9Tut.exe for writing

Advertisement

Then your program still is running. Check that you properly exit out of the main loop, just destroying the window does may not end your message pump, depending on how you built it.

Do you properly query for WM_QUIT?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

I was thinking that the program was still running too. Is there anyway to adjust visual studio to solve this problem?

The problem's not Visual Studio, but either your code or maybe a virus scanner interfering.

Show your main message pump loop.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

here is my message pump

	MSG msg;

	while (TRUE)
	{
		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		if (msg.message == WM_QUIT)
			break;

		render_frame();
	}

	// clean up DirectX and COM
	cleanD3D();

	return msg.wParam;
}

That doesn't look wrong.

Have you checked via debugger that cleanD3D is hit and you also reach the return? Then it's something else sitting on your executable.

Try Process Explorer to see who is having a handle on your file.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Do you spawn a window?

If so, a window isn't populating a WM_QUIT message if you simply hit the X button. WM_QUIT is populated only if you hit Alt + F4. A window instead populates WM_CLOSE which is from the docs

Sent as a signal that a window or an application should terminate.

Thats why I always use a switch statement in my message loop instead of a simple if/else/if

Do you call PostQuitMessage in your WM_CLOSE handler?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement