Question:
help with this win 32 app c++?
chingonsonson
2011-04-03 15:53:08 UTC
can any body tell me why this program doesn't not run it gives me an error while trying to run it on microsoft visual C++ 2010 .....on win32 application, the error says,

1>------ Build started: Project: Resources1, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:\Users\nueva\Documents\Visual Studio 2010\Projects\Hello World\Resources1\Debug\Resources1.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

--------- the programs is as follows i copy it from a website but i cant run it, im a rokie help please----


//---------------------------------------------------------------------------
#include

#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
//---------------------------------------------------------------------------
LPCTSTR ClsName = L"FundApp";
LPCTSTR WndName = L"Resources Fundamentals";
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam);
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG Msg;
HWND hWnd;
WNDCLASSEX WndClsEx;

// Create the application window
WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
WndClsEx.lpfnWndProc = WndProcedure;
WndClsEx.cbClsExtra = 0;
WndClsEx.cbWndExtra = 0;
WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClsEx.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClsEx.lpszMenuName = NULL;
WndClsEx.lpszClassName = ClsName;
WndClsEx.hInstance = hInstance;
WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

// Register the application
RegisterClassEx(&WndClsEx);

// Create the window object
hWnd = CreateWindowEx(0,
ClsName,
WndName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);

// Find out if the window was created
if( !hWnd ) // If the window was not created,
return FALSE; // stop the application

// Display the window to the user
ShowWindow(hWnd, nCmdShow);// SW_SHOWNORMAL);
UpdateWindow(hWnd);

// Decode and treat the messages
// as long as the application is running
while( GetMessage(&Msg, NULL, 0, 0) )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}

return Msg.wParam;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
// Process the left-over messages
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
// If something was not done, let it go
return 0;
}
//---------------------------------------------------------------------------
Three answers:
?
2011-04-03 16:03:21 UTC
Are you compiling it as a cosole project? You need to make a win32 project not console and compile it from there.
?
2011-04-03 16:06:01 UTC
This line says it all:



1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup



The linker (the program that pulls together all the pieces of code the program needs) couldn't find that _mainCRTStartup module, which, I suspect, is the name your main() needs to be named in the mode you're working. Visual Studio generally generates the skeleton main() function needed for the type of project you select.



Hope that helps.
burchill
2016-10-27 05:10:01 UTC
Wow, it truly is a not ordinary one.... Paris of direction has the length, yet i imagine of the fleas have an side; they have were given the appropriate value and the wit to outpace Paris. There may want to be an upset in the fleas' winning streak of 9-0, notwithstanding the stats do precisely no longer tournament up, i ought to grant this one to the fleas.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...