Posted on 2004-09-13
Medium Priority
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
   return 0;


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

Accepted Solution

efn earned 150 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.

Expert Comment

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"?
LVL 23

Expert Comment

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?

Author Comment

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

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

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.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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.

624 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