VS Express cannot start the program Xxx.exe, the system cannot find the specified file

Source: Internet
Author: User

Because the laboratory has a virus-containing software, the network management of the laboratory to seal the export, weekend people do not work. It seems that Raspberry Pi is not playing, so yesterday in the dorm to write Windows program, the most basic window program, I heard this code beginner to at least 5 times to knock over. The code is as follows:

#include <windows.h>LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); Before the name of this callback function is written in WinProc, the result compiler always prompts: undefined identity Fu Khan!!!!
intWINAPI WinMain (hinstance hinstance, hinstance hprevinstance, PSTR szCmdLine,inticmdshow) { StaticTCHAR szappname[] = TEXT ("mywindows"); HWND hwnd; MSG msg; Wndclass Wndclass; Wndclass.style= Cs_hredraw |Cs_vredraw; Wndclass.lpfnwndproc=WndProc; Wndclass.cbclsextra=0; Wndclass.cbwndextra=0; Wndclass.hinstance=hinstance; Wndclass.hicon=LoadIcon (NULL, idi_application); Wndclass.hcursor=loadcursor (NULL, Idc_arrow); Wndclass.hbrbackground=(Hbrush) getstockobject (White_brush); Wndclass.lpszmenuname=NULL; Wndclass.lpszclassname=Szappname; if(! RegisterClass (&wndclass)) {MessageBox (NULL, TEXT ("This program needs to be executed in Windows NT!"), Szappname, Mb_iconerror); return 0; } hwnd=CreateWindow (Szappname, TEXT ("Fish C"), Ws_overlappedwindow, Cw_usedefault, Cw_usedefault, Cw_usedefault, Cw_usedefault, NULL, NULL, HINSTANCE, NULL); ShowWindow (hwnd, icmdshow); UpdateWindow (HWND); while(GetMessage (&msg, NULL,0,0) {translatemessage (&msg); DispatchMessage (&msg); } returnMsg.wparam;} LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM WPARAM, LPARAM LPARAM) {HDC hdc; Paintstruct PS; Rect rect; Switch(message) { CaseWM_PAINT:HDC= BeginPaint (hwnd, &PS); GetClientRect (hwnd,&rect); DrawText (hdc, TEXT ("Hello everyone, this is my first window program! "), -1, &rect, Dt_singleline| Dt_center |dt_vcenter); EndPaint (hwnd,&PS); return 0; CaseWm_destroy:postquitmessage (0); return 0; } returnDefWindowProc (hwnd, message, WParam, LParam);}/*Windows window Birth Process Definition window class structure (WNDCLASS)--window class (registerclass), create window (CreateWindow), display window (ShowWindow), Update window (updatewindow), message loop (getmessage->translatemessage->dispatchmessage)*/

When I first run this code, there is no problem, the successful display of a basic window, and point out the zoom, the upper right corner of the three buttons are also useful

But the same piece of code in the early morning, the runtime reported such a mistake:

My Baidu (sweat, * wall encountered a bit of difficulty) a night, has not found a suitable solution. Finally, I really have no way, at the same time open these two projects, to their configuration to see their differences, this is the most stupid way. Finally found the source of the bug: This is a window program, but I set up in the configuration as a console program so there are only two solutions: 1. Change the configuration to a window program. 2. When creating a new project, set it as a window program, not a console program, in fact, and scenario one is the same thing.

The First solution: Select Windows in the toolbar--Properties------and the subsystem--and then save. So recompile, the link can run, I guess two different options, the linker will chain a different library, if the window program chain is the console of the library of course not run.

Second Solution: Select the Win32 project instead of the WIN32 console application when creating a new project

Well, the tour of Windows programming begins!

VS Express cannot start the program Xxx.exe, the system cannot find the specified file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.