What is _MAIN__?

What is _MAIN__?

I get a linker error:

1>libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _main

I don't have a function _main, and I never call _MAIN__. So what's
going on? I have some Fortran code in a lib and the C++ code as the
main project. This worked on VS6 and CVF fortran.

I tried adding a function

void main()

{

}

but then the linker complained about duplicate definitions. Advice, someone?

16 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

_MAIN__ is the linker symbol that the Fortran library uses for the main program.

The linker thinks (as a consequence of the libraries and object code that have been presented to it) that you are trying to build a Fortran main program. This indicates that the linker isn't seeing the C++ startup libraries and/or entry point.

Do you have the standard C++ entry point function "main" or are you perhaps using WinMain, wWinMain, wmain, or something similar for your C++ program's entry point? Nomenclature and options for specifying that may have changed with the change in VS version.

My C++ program was declared the main project when I converted from VS6 + CVF. So I expected that the system would not try to make the Fortran code the entry point. The C++ code starts out with

/////////////////////////////////////////////////////////////////////////////
// CSYNOPSYSApp construction

CSYNOPSYSApp::CSYNOPSYSApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CSYNOPSYSApp object

CSYNOPSYSApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CSYNOPSYSApp initialization

BOOL CSYNOPSYSApp::InitInstance()
{
AfxEnableControlContainer();
AfxInitRichEdit();

...

How should I change this? The linker sees all of the obj files, both C++ and Fortran.

>So I expected that the system would not try to make the Fortran code the entry point.

That is expecting too much from the "system". It does not know much about the conventions of specific languages, let alone mixed-language applications. Just as one fails when trying to use the C++ compiler to link an OBJ file that was produced by the Fortran compiler and contains the program entry point, the build system fails if you do not help it.

The build system "thinks" in terms of projects, solutions and files, not specific programming languages.

Well, that is all very true -- but it does not solve my problem. I had a working project on CVF and VS6, and converted it to Intel Fortran and VC10, according to the directions in several documents. Everything compiles but it won't link. It seems that the system does not know where to start the program.

Since VC10 has a dialog that lets you do this kind of conversion, I thought it was fair to assume that they had anticipated the issues and took the necessary steps. That dialog asks which is the main program, Fortran or C++, and I selected C++. Why ask for that, unless the information tells the system where to start at run time? So my assumption does not seem to be "expecting too much". And anyway, there seems to be no other way to do this kind of conversion.

So that's my question: how do I tell it to start with the C++ code? All the Fortran routines are called by the C++ code where needed. There seems to be a routine somewhere called for_main.obj, which wants to call _MAIN__. Why is that routine there (and where is it? I cannot find it by searching.) I did not create it.

Will someone please tell me how to proceed? How do I correct this error:

1>libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _main

Perhaps you answered the question as to where the main program was incorrectly? The error suggests that the Fortran code is "console application" project type rather than a static library, but it could be something else.

Please attach the Fortran buildlog.htm from the Debug or Release folder so I can see what you did.

Steve - Intel Developer Support

Here is that file. Good luck!

Build Log

 Build started: Project: SYNOPSYS200_lib_, Configuration: Debug|Win32 

Output

Compiling with Intel Visual Fortran Compiler XE 12.1.1.258 [IA-32]...
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Wview.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Film.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl09.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S12.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Polar.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl23.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl03.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S09.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Lp.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Ai1.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Worksheet.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S03.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Expert.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl08.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl16.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl02.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S08.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Ai.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S02.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl54.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl07.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\dovl14.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Automf.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S07.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Lck.FOR"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\W95pad.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S01.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl44.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl06.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Nonseq.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl13.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S06.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Global.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\User.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S00.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl34.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl05.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S11.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\MOMF.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl12.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Ai3.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S05.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\GlassTable.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Tosp.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Realpupil.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl24.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl04.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S10.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\MC.FOR"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Dovl10.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Ai2.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\S04.for"
ifort /nologo /debug:full /Od /Ot /I&quotDebug/" /extend_source:132 /pad_source /warn:none /Qsave /align:commons /assume:byterecl /Qzero /fpconstant /iface:cvf /module:&quotDebug/" /object:&quotDebug/" /Fd&quotDebug\vc100.pdb" /check:bounds /check:format /libs:static /threads /dbglibs /winapp /c /Qvc10 /Qlocation,link,&quotc:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" &quotC:\SYNOPSYSV14\Win95.for"
Creating library...
Lib /OUT:&quotDebug/SYNOPSYS200_lib_.lib" /NOLOGO &quotDebug/Wview.obj" &quotDebug/Film.obj" &quotDebug/Dovl09.obj" &quotDebug/S12.obj" &quotDebug/Polar.obj" &quotDebug/Dovl23.obj" &quotDebug/Dovl03.obj" &quotDebug/S09.obj" &quotDebug/Lp.obj" &quotDebug/Ai1.obj" &quotDebug/Worksheet.obj" &quotDebug/S03.obj" &quotDebug/Expert.obj" &quotDebug/Dovl08.obj" &quotDebug/Dovl16.obj" &quotDebug/Dovl02.obj" &quotDebug/S08.obj" &quotDebug/Ai.obj" &quotDebug/S02.obj" &quotDebug/Dovl54.obj" &quotDebug/Dovl07.obj" &quotDebug/dovl14.obj" &quotDebug/Automf.obj" &quotDebug/S07.obj" &quotDebug/Lck.obj" &quotDebug/W95pad.obj" &quotDebug/S01.obj" &quotDebug/Dovl44.obj" &quotDebug/Dovl06.obj" &quotDebug/Nonseq.obj" &quotDebug/Dovl13.obj" &quotDebug/S06.obj" &quotDebug/Global.obj" &quotDebug/User.obj" &quotDebug/S00.obj" &quotDebug/Dovl34.obj" &quotDebug/Dovl05.obj" &quotDebug/S11.obj" &quotDebug/MOMF.obj" &quotDebug/Dovl12.obj" &quotDebug/Ai3.obj" &quotDebug/S05.obj" &quotDebug/GlassTable.obj" &quotDebug/Tosp.obj" &quotDebug/Realpupil.obj" &quotDebug/Dovl24.obj" &quotDebug/Dovl04.obj" &quotDebug/S10.obj" &quotDebug/MC.obj" &quotDebug/Dovl10.obj" &quotDebug/Ai2.obj" &quotDebug/S04.obj" &quotDebug/Win95.obj"
xilib: executing 'lib'


SYNOPSYS200_lib_ - 0 error(s), 0 warning(s)

Ok, that is correctly a library. Does the C++ executable project have a main program? Did you follow the instructions in the Fortran release notes for configuring VS2010 for mixed-language applications and for reestablishing project dependencies?

Steve - Intel Developer Support

Well, yes, I thought I did. I opened the old dsw file and got a dialog saying that it must be converted. So I did just that. Then, in the window that opened, I right-clicked the project name and selected Extract Compaq Visual Fortran Project Items. Then the wizard asked me which was the main project, Fortran or C++, and I selected the latter.

Then I added the library entry $(IFORT_COMPILER12)\compiler\lib\ia32 in the Property Manager. To establish dependencies, I went to Project Dependencies and selected the box under "Depends on:" for SYNOPSYS200_lib_.

So as far as I know, I did everything right. There is one curious result, though -- and since I have never done this conversion before, I don't know if it is correct. In my Solution Explorer, I get the following:

- SYNOPSYS200
+ External Dependencies
+ Fortran Files
+ Resources
+ Source Files
(a filename.h, declaring some COMMON blocks as C++ structures)
- SYNOPSYS200_lib_
+ Fortran Files
+ Resources
+ Source Files

What's curious is that the item "+ Fortran Files" shows up twice. Is that normal?

And, no, my C++ programs do not have a "main" program. Nor does the Fortran code. The C++ program is supposed to start at the excerpt below:

...
/////////////////////////////////////////////////////////////////////////////
// CSYNOPSYSApp construction

CSYNOPSYSApp::CSYNOPSYSApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CSYNOPSYSApp object

CSYNOPSYSApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CSYNOPSYSApp initialization

BOOL CSYNOPSYSApp::InitInstance()
{
AfxEnableControlContainer();
AfxInitRichEdit();
...

There is no "main()". There is a message map section just before the code above, and after that routine comes a series of subroutines that get called eventually from elsewhere. When the program starts (on VS6) my InitInstance() gets called by AfxWinMain(). It calls a subroutine to create and initialize a Rich-edit window, and returns. Then AfxWinMain() calls my routine run(), which is an override of the run loop, used to emulate a DOS window in that edit window. All of this works fine on the old version.

Can you think of a way to make this work in VS10? I have many man-years invested in this code, which is kind of huge, so rewriting it all in C++ is not feasible. Where do I tell the OS which part of the code to start with? Is the override of run() something that has to be declared to the compiler or linker?

Thank you, Steve, for your help. I hope this will converge quickly. Maybe just a setting here or there?

You need to do more - please read section 3.8 of the Fortran release notes.

I am not familiar with how this sort of C++ program is structured. I am a bit puzzled that you are getting the reference to _MAIN__ pulled in from the Fortran code. I am sure we can get you working - is it possible for you to attach a ZIP of your C++ and Fortran projects (after doing a Build > Clean)?

Steve - Intel Developer Support

That's an MFC app. The "real" C++ language entry point is hidden in the MFC support libraries. VS6 to VS2010 is a pretty big jump, so perhaps that's introduced some link issues.

From what I've seen - if you have fortran object code (sans program) that's been compiled against the static linked version of the C runtime and you link it against C++ code (sans main) that's also been compiled against the statically linked version of the C runtime you'll get complains about missing _MAIN__. I presume this is due to default library specifications in the object code (if the C++ compiler hasn't put _main in the object code then that symbol gets picked up instead from the Fortran runtime libraries - _main in the Fortran runtime libraries then references _MAIN__).

I think I now have the answer to this. Your C++ project has added options to ignore specific default libraries, probably because you have a mixture of C run-time library types in the application. The C++ program wants the multithreaded debug DLL libraries, the Fortran library wants multithreaded debug static, and the third-party library wants multithreaded non-debug static. While Fortran doesn't particularly care about which you choose, C++ does, and it generates different code depending on your choice.

If I set both the C++ and Fortran projects to use multithread debug DLL libraries, the error for _MAIN__ goes away. But then there are errors from the third-party library because you have chosen the static version. You may get better results from using the DLL form of the third-party library.

Steve - Intel Developer Support

Steve:

That was an encouraging suggestion, but when I tried it I got the same error. Perhaps I did not set the libraries correctly.

My C++ command line contains "/MDd", and the Fortran line contains "/libs:dll /threads /dbglibs".

I set the first in Properties > C/C++ > Code Generation > Runtime LIbrary = Multi-threaded Debug DLL, and the second in Properties > Fortran > Libraries > Runtime Library = Debug Multithread DLL.

Did I do something wrong? The error for _MAIN__ is still there.

The settings you have should be ok. I just tried it again and only saw errors from the third-party library, no reference to _MAIN__ which I had seen earlier.

Steve - Intel Developer Support

Steve:

You must have also changed something else, since my results are not the same as yours. Is there a component file that has all of the settings in it that you could send me? Or is there anything else I can send you that would give you more clues?

Closing this out in a non-private reply - I supplied the project files I was using and the _MAIN__ error went away. So this aspect of the problem is solved. Glad to have been of assistance.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today