www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Cannot build simple Win32 console program

reply "James" <ploppy.powell virgin.net> writes:
What am I doing wrong ??

I'm trying to get started with DM and I can't seem to get a simple win32
console program to build.
I'm using the win32 IDDE.

The .def file:

EXETYPE          NT
SUBSYSTEM        CONSOLE


The code:

#include <iostream.h>
void main ()
{
 cout << "Hello\n";
}


The build output:

Program Files\dm\bin\sc.EXE -cpp -mn -C -WA -S -5 -a8 -c -gf -otest.obj
test.c
Program Files\dm\bin\scpp.EXE -cpp -mn -C -WA -S -5 -a8 -gf
test.c -otest.obj
Program Files\dm\bin\link.EXE /CO /NOI /DE /NOPACKF /XN /NT
/ENTRY:WinMainCRTStartup /BAS:4194304 /A:512  modflnm.LNK
Error: C:\PROGRAM FILES\DM\BIN\..\lib\SNN.lib(winstart)  (1231004): Symbol
Undefined _WinMain 16
Lines Processed: 843  Errors: 1  Warnings: 0
Build failed
Aug 09 2002
parent reply Jimmy Burgett <jburgett erols.com> writes:
My def file looks different:
--------------------------------------
NAME 
	"hello" WINDOWAPI
DESCRIPTION 
'hello'
EXETYPE 
	NT
SUBSYSTEM 
CONSOLE
STUB 
	'WINSTUB.EXE'
CODE 
	 EXECUTE READ
DATA 
	 READ WRITE
STACKSIZE 
1048576,4096
HEAPSIZE 
1048576,4096
-------------------------------------
And the compiler output is:

sc hello.cpp -mn -o+time -WA -3 -a8 -c -D_CONSOLE=1 -ohello.obj
link /NOI /DE /E /PACKF /XN /NT /ENTRY:mainCRTStartup /BAS:4194304 
/A:512  hello.LNK
ren .\$SCW$.EXE hello.EXE
.\hello.EXE built
Lines Processed: 17699  Errors: 0  Warnings: 0
Successful build


Did you use the new project wizard to set up your project?
The only nonstandard thing I had to do was add stlport_dm_static.lib
to my project because I am playing with the STL port. (Their include
file come first on the search line)

Jimmy
Aug 09 2002
parent "James" <ploppy.powell virgin.net> writes:
Thanks, I've already sorted it.
It was as easy as changing the Project Settings/Target Type from Executable
to Console


"Jimmy Burgett" <jburgett erols.com> wrote in message
news:3D53CC40.9040304 erols.com...
 My def file looks different:
 --------------------------------------
 NAME
 "hello" WINDOWAPI
 DESCRIPTION
 'hello'
 EXETYPE
 NT
 SUBSYSTEM
 CONSOLE
 STUB
 'WINSTUB.EXE'
 CODE
 EXECUTE READ
 DATA
 READ WRITE
 STACKSIZE
 1048576,4096
 HEAPSIZE
 1048576,4096
 -------------------------------------
 And the compiler output is:

 sc hello.cpp -mn -o+time -WA -3 -a8 -c -D_CONSOLE=1 -ohello.obj
 link /NOI /DE /E /PACKF /XN /NT /ENTRY:mainCRTStartup /BAS:4194304
 /A:512  hello.LNK
 ren .\$SCW$.EXE hello.EXE
 .\hello.EXE built
 Lines Processed: 17699  Errors: 0  Warnings: 0
 Successful build


 Did you use the new project wizard to set up your project?
 The only nonstandard thing I had to do was add stlport_dm_static.lib
 to my project because I am playing with the STL port. (Their include
 file come first on the search line)

 Jimmy
Aug 09 2002