Solved

PROBLEM

Posted on 2004-09-13
5
174 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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 recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now