Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 25th, 2007, 4:22 PM   #1
PMAprogrammer
Newbie
 
Join Date: Aug 2007
Posts: 3
Rep Power: 0 PMAprogrammer is on a distinguished road
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 . Any ideas?
PMAprogrammer is offline   Reply With Quote
Old Aug 25th, 2007, 5:39 PM   #2
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 730
Rep Power: 4 Dameon is on a distinguished road
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.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Aug 25th, 2007, 5:47 PM   #3
PMAprogrammer
Newbie
 
Join Date: Aug 2007
Posts: 3
Rep Power: 0 PMAprogrammer is on a distinguished road
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)
{
    switch(Msg)
    {
        // if the user wants to close the application
        case WM_DESTROY:
            {
                // then close it
                PostQuitMessage(0);
                break;
            }
        default:
            // Process the left-over messages
            return DefWindowProc(hWnd, Msg, wParam, lParam);
    }
    // if something was not done, let it go
    return 0;
}

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 =/
PMAprogrammer is offline   Reply With Quote
Old Aug 25th, 2007, 6:39 PM   #4
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 887
Rep Power: 4 lectricpharaoh will become famous soon enough
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.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Old Aug 25th, 2007, 7:01 PM   #5
PMAprogrammer
Newbie
 
Join Date: Aug 2007
Posts: 3
Rep Power: 0 PMAprogrammer is on a distinguished road
Tried it but still no dice.
PMAprogrammer is offline   Reply With Quote
Old Aug 26th, 2007, 12:31 AM   #6
dr.p
Programmer
 
dr.p's Avatar
 
Join Date: Feb 2006
Location: Ohio
Posts: 93
Rep Power: 3 dr.p is on a distinguished road
You might try handling the WM_CLOSE message in your WinProc function by calling DestroyWindow() and passing your main window handle to it.
__________________
Neeley.org
dr.p is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Header file internal errors kruptof Coder's Corner Lounge 2 Jan 14th, 2007 1:12 PM
C# corruption!!! Kilo C++ 32 May 21st, 2006 8:44 PM
Masm rsnd Assembly 4 May 20th, 2006 9:05 PM
libraries matko C 1 Jan 22nd, 2006 2:12 PM
After execution - Error cannot locate /Skin File? wchar Visual Basic 1 Mar 5th, 2005 9:04 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:50 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC