Compiling a root application with MS VC6

Hi,

I am trying to compile hello.cxx using MS VC6.
I succeeded to make a project file and the workspace,
and even I can compile and link the project. There is,
however, one error message I cannot rid off:

Linking…
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Hello.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

I guess that the main() is missing (in the console version) or
(WinMain in the windows version). What is the trick to build the app?
Is there a makefile around?

BTW: I also tried the following, with no success.
Do I wrong something?

Regards
Janos

C:\root\test>nmake -f makefile.win32

Microsoft ® Program Maintenance Utility Version 6.00.8168.0
Copyright © Microsoft Corp 1988-1998. All rights reserved.

makefile.win32(7) : fatal error U1052: file ‘win32.mak’ not found
Stop.

Hi Janos,
you didn’t say anything about your ROOT version.
Everything works OK with ROOT supported version
WindowsXP/NT/w2000 with VC++ 7.1 (runs with VC++6), version 4.01/04 (good old tar file) WIN32GDK

Just run “make” in test directory.

Regards. Valeriy

[quote=“Valeriy Onuchin”]Hi Janos,
you didn’t say anything about your ROOT version.
Everything works OK with ROOT supported version
WindowsXP/NT/w2000 with VC++ 7.1 (runs with VC++6), version 4.01/04 (good old tar file) WIN32GDK

Just run “make” in test directory.

Regards. Valeriy[/quote]

Hi Valeri,

this is the ROOT login:

  • Version 4.00/08 9 July 2004 *
    Compiled for win32.
    CINT/ROOT C/C++ Interpreter version 5.15.138, May 23 2004

Concerning make:
I have a Borland compiler installed, that fires first:

F:\root\test>make
MAKE Version 5.2 Copyright © 1987, 2000 Borland
Error makefile 10: Command syntax error
Error makefile 18: Command syntax error
Error makefile 20: Command syntax error
Error makefile 22: Command syntax error

The funny business is that right now nothing is found,
although the file is there:
root [0] .x hsimple
Error in TRint::ProcessFile: macro hsimple not found in path .;f:/root/macros
root [1] .x hsimple.h
srror in TRint::ProcessFile: macro hsimple.h not found in path .;f:/root/macro
root [2] .x mydemo.h
Error in TRint::ProcessFile: macro mydemo.h not found in path .;f:/root/macros
root [3] .q

This is the end of ROOT – Goodbye

F:\root\tutorials>dir hsim*.c
Volume in drive F is DATA
Volume Serial Number is 2861-9393

Directory of F:\root\tutorials

2004.04.20 19:02 2 332 hsimple.C
1 File(s) 2 332 bytes
0 Dir(s) 27 321 122 816 bytes free

F:\root\tutorials>

Janos

Hi Janos,

  1. as I mentioned “win32” is not supported version
  2. root [0] .x hsimple.C //not .x hsimple
  3. you need to use MS VC (>= 6.0) compiler. Not Borland.

Regards. Valeriy

[quote=“Valeriy Onuchin”]Hi Janos,
3. you need to use MS VC (>= 6.0) compiler. Not Borland.

Regards. Valeriy[/quote]

Hi Valery,

In case of MS VC, I think I need nmake (rather than make)
This alone, results in

F:\root\test>nmake

Microsoft ® Program Maintenance Utility Version 6.00.8168.0
Copyright © Microsoft Corp 1988-1998. All rights reserved.

Makefile.arch(8) : fatal error U1033: syntax error : ‘=’ unexpected
Stop.

With the correct usage (I guess)
F:\root\test>nmake -f makefile.win32

Microsoft ® Program Maintenance Utility Version 6.00.8168.0
Copyright © Microsoft Corp 1988-1998. All rights reserved.

makefile.win32(7) : fatal error U1052: file ‘win32.mak’ not found
Stop.

And really, that file is missing from the distribution.
Could you please help me how to find it?

Thanks

Janos

Hi Janos, ooops …
da, really, two choises here

  1. nmake -f Makefile.win32
    but this makefile doesn’t compile many of the programs, e.g.
    guitest, guiviewer etc

  2. run cygwin’s make for $ROOTSYS/test/Makefile.
    It uses MS VC compiler, linker

  3. … or create VC project. VC7.1 projects for $ROOTSYS/test
    programs are in attachment.

Regards. Valeriy
test.zip (404 KB)

[quote=“Valeriy Onuchin”]Hi Janos, ooops …

  1. … or create VC project. VC7.1 projects for $ROOTSYS/test
    programs are in attachment.

Regards. Valeriy[/quote]

Hi Valery,

this would be optimal for me. Could you please send these project files
in VC6 format (or the corresponding makefile)? Thanks in advance.

Regards,
Janos

Hi Janos,
I just searched my computer … seems I lost
my VC6 projects files for $ROOTSYS/test. I’ll check it
in another place. Meanwhile you can use
$ROOTSYS/test/Makefile.win32 which works with VC6
although compilation of some programs is missing.

Regards. valeriy

Hi Valery,

I would, but the file ‘win32.mak’ is missing from the distribution.

Janos

Hi Janos,
win32.mak is in C:\Program Files\Microsoft Visual Studio\VC98\Include

To compile $ROOTSYS/test programs you should first to
"tune" VC inviroment by execution of
C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat

Regards. Valeriy