linker error for awindows 98 program in c++

i have just started learning windows 98 programming and am stuck with the first program that is simple window skeleton creation i use windows 98 second edition and have compiled the code in turboc++,vc++ bc++and am getting the linker error unresolved external symbol _main in  crto.obj plaese help so that i could go on further.
     satish
satishkrAsked:
Who is Participating?
 
mblatCommented:
Are you building ATL project?  

If so resolution here is to remove _ATL_MIN_CRT from the list the preprocessor defines to allow CRT startup code to be included.

From the Project menu, click Settings.

In the Settings For drop-down list, select Multiple Configurations.

In the Select project configuration(s) to modify dialog box that displays, select the check boxes for all release versions, and then click OK.

Click the C/C++ tab in the Project Settings dialog box, and then choose the General category.

Remove _ATL_MIN_CRT from the Preprocessor definitions edit box.

Hope it helps....

( instructions for VC++ )
0
 
TriskelionCommented:
Do you have a function called main() in your code?    
Can you post the function prototype for  your main() here?

Is this a console (DOS) app or something else?      
0
 
satishkrAuthor Commented:
yes i do have a function called WinMAin in my code
and here is the actual code try compiling ur self and let me know
/*a minimal windows 98 skeleton */
#include <windows.h>

LRESULT CALLBACK WindowFunc(HWND,UINT,WPARAM,LPARAM);
char szWinName[] = "MyWin"; /*name of window class*/
int WINAPI WinMain(HINSTANCE hThisInst,HINSTANCE hPrevInst,LPSTR lpSzArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wcl;

/* define a window class */
wcl.cbSize = sizeof(WNDCLASSEX);

wcl.hInstance = hThisInst; /* handle to this instance */
wcl.lpszClassName = szWinName; /* window class anme */
wcl.lpfnWndProc = WindowFunc; // window function
wcl.style = 0; //defaultstyle

wcl.hIcon = LoadIcon(NULL,IDI_APPLICATION); //standard icon
wcl.hIconSm = LoadIcon(NULL,IDI_WINLOGO); //small icon
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);//cursor style

wcl.lpszMenuName = NULL; // no menu
wcl.cbClsExtra = 0; //no extra information needed
wcl.cbWndExtra = 0; //no extra informaton needed

//make the window background white
wcl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);

//register the window class
if(!RegisterClassEx(&wcl)) return 0;

//now that a window class has been registered , a window can be created
hwnd = CreateWindowA(
  szWinName, /*name of window class*/
  "Windows 98 Skeleton", //title
  WS_OVERLAPPEDWINDOW,//window style - normal
  CW_USEDEFAULT,//x coordinate let windows decide
  CW_USEDEFAULT,//y coordinate let windows decide
  CW_USEDEFAULT,//width let windows decide
  CW_USEDEFAULT,//height let windows decide
  HWND_DESKTOP,//no parent window
  NULL, //no menu
  hThisInst, //handle of this instance of the program
  NULL //no additional arguments
  );


  //display the window
  ShowWindow(hwnd, nWinMode);
  UpdateWindow(hwnd);

  //create the message loop
  while(GetMessage(&msg, NULL, 0, 0))
  {
  TranslateMessage(&msg); //translate keyboard messages
  DispatchMessage(&msg); //return control to windows 98
  }
  return msg.wParam;
  }

  //this function is called by windows 98 and is passed messages from
   //the message queue
  LRESULT CALLBACK WindowFunc(HWND hwnd,UINT message,WPARAM wParam,
   LPARAM lParam)
  {
  switch(message) {
    case WM_DESTROY: //terminate the program
      PostQuitMessage(0);
      break;
      default:
      //let windows 98 process any message not specified in the
      //preceding switch statement.
      return DefWindowProc(hwnd,message,wParam,lParam);
      }


     
      return 0;
      }


0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
satishkrAuthor Commented:
sorry guys for not putting my question properly i dont get any errors when compiling in any compiler but i get the same linker error in all the compilers (tc,bc++,
Vc++ ver6.0) the author of thebook windows 98 programming has specified that all the code can be run with vc++and has asked not to select any class library support
0
 
mblatCommented:
ok, my guess here is that you creating wrong type of project.

See, when you just type text to a file and ask compiler to compile it, VC++ creates default project, which is Win32 CONSOLE app.

What you need is Win32 Application type of project.

So go to VC++. Say File->New->Projects->Win32 Application.  Select "Empty project".

Then you need to add your file to a project.
To do so:
 expand project tree, right click on "source file", select "Add file to project".


Hope it helps...
0
 
satishkrAuthor Commented:
mblat yur suggestion has worked thank u i got the output thanks a lot
0
 
mblatCommented:
So where is the grade then? :-)
0
 
griesshCommented:
Dear satishkr

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "mblat"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
MindphaserCommented:
Force accepted

** Mindphaser - Community Support Moderator **
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.