Solved

PROBLEM

Posted on 2004-09-13
5
177 Views
Last Modified: 2010-04-15
hi i wanted to write my first program, that i guess u know "hello world".
i wrote this in dos application there was no problem.
when i tried to write this in windows equivalent i had some problems.

my program:


#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE        
          hPrevInstance, PSTR szCmdLine, int iCmdShow)

{
   messagebox (NULL, TEXT("Hello World"), TEXT
              ("HelloMSG"),0);
   return 0;
}


errors:

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external
                      symbol _main
debug/deneme.exe    : fatal error LNK1120: 1 unresolved
                      externals
deneme.exe - 2 error(s), 0 warning(s)
0
Comment
Question by:sercanparlak
5 Comments
 
LVL 15

Accepted Solution

by:
efn earned 50 total points
ID: 12048252
You need to tell your development environment that you want a Win32 application, not a console application.  Details will vary depending on what environment you have.
0
 
LVL 7

Expert Comment

by:aib_42
ID: 12048494
Also, that system call is MessageBox, not messagebox. Using "messagebox" will probably give you more linker errors.

One more thing:
What is TEXT("")? Why would you need such a construct to make/use strings while you can make perfectly good C-strings by just using the "quotes"?
0
 
LVL 23

Expert Comment

by:Mysidia
ID: 12050568
TEXT("") conditionally marks the literal to use unicode conversion
best to get in the habit of using TEXT instead of C strings early!

As for the errors...   What compiler/IDE?
0
 

Author Comment

by:sercanparlak
ID: 12051750
thank u so much guys. i solve the problem with ur sayings. Now it is working.
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to organize data in excel ? 2 114
voltage to force translation ? 8 99
Unable to start eclipse ? 17 141
Why  my code (program) build with old compiler? 11 45
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question