Solved

PROBLEM

Posted on 2004-09-13
5
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XCode crashes while uploading to app store. 5 273
C language IDE – Compilers installation 14 88
How to creat good software interface ? 1 76
Global Keyboard Hooks Blocked 4 97
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files 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.
Suggested Courses

734 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