Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Visual Fortran Build Command error

Deleted_U_Intel
Employee
478 Views
Could you please prompt me with what to do with an ''unresolved external symbols'' error message when I try to build a solution consisting entirely of Fortran source code? Thank you.
0 Kudos
2 Replies
jparsly
New Contributor I
478 Views

It probably tells youthe names of the unresolved external symbols, which will help.

If the symbol looks like the name of one of your arrays, then perhaps you have omitted a declaration. In some contexts, an undeclared array will be interpreted to be a function. (i.e. x=array(i), without a declaration, as far as the compiler knows, 'array' is a function, and this won't get caught until the link.

If the symbol looks like one of your subroutine names, but with a extra symbol and a number at the end, then check to see if one of your routines is called with the wrong number of arguments, or if the variable types between the caller and callee are different (particularly mismatched between character and non-character types). The number at the end of the symbol, dvided by a constant (4?) has something to do the number of arguments being passed. Depending on compiler options, characters variable often create two arguments, one for the address of the variable, and one for the length. This sort of thing will usually be caught if you compile all your code at once, so that the compiler 'sees' all the calls and subroutine/function declarations and can check that everything matches.

If the problem is not one of these, you might be using a library routine which needs either a USE statement, or needs to be added to the libaries that the linker will look through. It could be a library routine that was available with your old compiler/operating system and has a new name on the new one. Routines used to get command line arguments, perform system calls, and get date and time information often fall into this category.

0 Kudos
Steven_L_Intel1
Employee
478 Views
Susan,
Thanks for telling us the name of the symbol. This is the major clue.
When you created the project, you were given a choice of several project types. What you wanted was "Fortran Console Application", but what you selected instead was "Fortran Windows Application". The first is the traditional Fortran program as you would run it on a VAX. The second is a specialized form of program for Windows which requires that you not have a main program, but rather enter the code through a function called WinMain (or, as the name is "decorated", _WinMain@16.) You don't have that function so the link fails.
The solution is to create a new project of the correct type and add your source files to it. For more information on the different project types, see the Visual Fortran Getting Started Manual.
0 Kudos
Reply