![]() |
Cannot open output file error
Hey guys,
My friend and I just recently started creating a win32 application in Codeblocks IDE. To start we created the simplest window you can make. It does nothing except draw itself on the screen and wait for someone to close it. Codeblocks lets me compile/run my program only once though. When my program executes I exit properly and codeblocks tells me that the process terminated. The thing is, every time after that when I try to compile it gives me this: Switching to target: default Linking executable: D:\Temp\Win32Test\Win32GUI.exe D:\Apps\CodeBlocks\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe: cannot open output file D:\Temp\Win32Test\Win32GUI.exe: Invalid argument collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings It seems as though after one execution of my program windows won't let go of the .exe file. I can't even go to the directory and delete it or anything. It just won't let me touch it. It only let's me compile the program once every time I start my computer..then it acts like I never closed the window and the program is still running. I'd love to be able to make more then one change to my program every time I turn my computer on :D . Any ideas? |
Closing a window does not force a program to exit.
Firefox exits when all windows are closed. Others exit when the main window is closed. It is up to the programmer to handle the closing of windows appropriately such that the program exits in an expected way. Check for your program in the task manager (ctrl+shift+esc), kill it, correct the code, and recompile. |
I check for the running process all the time and it's never still running according to my task manager.
Sorry, I should have posted the way I handle the exit in the first post. :
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)That's my function that responds to all events. When I click on the X in the upper right hand corner, my understanding is that windows fires a WM_DESTROY event to my program and then I handled it my posting a quit message which would close the program. Even with all this the annoying behavior persists =/ :confused: |
When you open up Task Manager, don't look on the 'Applications' tab. This only shows things that have a UI up and running. Look on the 'Processes' tab, and kill your app there.
|
Tried it but still no dice.
|
You might try handling the WM_CLOSE message in your WinProc function by calling DestroyWindow() and passing your main window handle to it.
|
| All times are GMT -5. The time now is 3:10 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC