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

LNK2019 Error

Boyd_G_
Beginner
1,361 Views

I'm working with Fortran code that includes about 20-25 subprograms, either via SUBROUTINE, FUNCTION, or ENTRY statements.  About 6 or 7 of these subprograms generate an LNK2019 unresolved reference error, even though the subprogram source code is indeed in the source file.  What fix is necessary so that I can move on?

I've verified that the subprogram declaration (where I name the subprogram and specify inputs) are consistent with the calls and the calling arguments.  I can find nothing that differs from the subprograms with the LNK2019 error and those that have no errors.

0 Kudos
17 Replies
Steven_L_Intel1
Employee
1,361 Views

It would be helpful to see the actual error messages, better to attach a zip of the buildlog.htm, and best to attach a zip of a small project that demonstrates the problem. Otherwise there's little we can do to answer your question. Knowing which compiler options were specified is also essential.

Usually what I would recommend is trying to construct a small example that shows the problem. In many cases the resolution will become evident while you are doing this.

0 Kudos
Boyd_G_1
Beginner
1,361 Views

Thank you Mr. Lionel.  Past posts show your help is golden.  I'll be putting together some screen shots on actual error and relavent (hopefulle) shots of the source code.  I'll post once I get them together.  The proj demo I can't do and intend for the code screen shots to "replace".  I'm not sure how to show compiler options.  It may be a deries of screen shots because I know no other way.  I'll begin getting it together right away.

Boyd G

0 Kudos
Steven_L_Intel1
Employee
1,361 Views

The build log will show all the options. But screenshots of source code are generally not helpful so I would not spend time on that. If you attach a zip of the buildlog.htm (showing a full rebuild of the project) maybe something will be obvious there.

0 Kudos
Boyd_G_1
Beginner
1,361 Views
[Deleted by Steve L - non-useful references to PC-local files]
0 Kudos
Boyd_G_1
Beginner
1,361 Views

screen shots attached.  build log is the last screen shot.

0 Kudos
Boyd_G_1
Beginner
1,361 Views

Tried to attach screen shots, build log last shot

[Edited by Steve L to remove useless local image references]

0 Kudos
mecej4
Honored Contributor III
1,361 Views

You have tried to include image files on your local PC in your post. That will not work, since your PC is not a server that is set up to serve image files that are on its hard drive to anyone who requests them. There is a procedure for uploading the files to the Intel Forum server and then including links to them in your post. However, given the large number of screen shots with incomplete information that I saw in the .DOCX attachment, I don't think that doing so will be of much use.

Simply zip up all the source files in your project (including any INCLUDEd files and data files), the project files and the buildlog.htm file, and attach the zip file to your reply. (I am assuming that you do not object to the public seeing your sources.)

0 Kudos
Steven_L_Intel1
Employee
1,361 Views

I deleted the broken screenshot links so as to not waste people's time.

As I said above, screenshots are not useful.

0 Kudos
Boyd_G_1
Beginner
1,361 Views

Attached just the Build Log screen shot.  Apologies for the past post overload.

0 Kudos
Steven_L_Intel1
Employee
1,361 Views

This is still not what we asked for, but it's a start. I had asked for a zip of the buildlog.htm from a complete rebuild, not a screenshot of the output pane. (Zip because one can't attach .htm files directly.)

The most obvious issue I see is that what is being built is not a complete program - there's no main program. My guess is that there are other sources in the application, defining the main program and the missing subroutines, not part of this project.

0 Kudos
Boyd_G_1
Beginner
1,361 Views

Thank you.  The point of all the screen shots was to show that all the source code was there, main, and subprograms which couldn't be found - linked.  Unquestionably my inability to properly use Visual Studio is the problem.  I'd like to start with that code from scratch, that is build the program as if it were new.  But it keeps coming back to the same place for some reason.  I don't understand the difference between a "solution" and a "project".  I don't know how to "start-over" with that source code with Visual Studio.

0 Kudos
mecej4
Honored Contributor III
1,361 Views

Boyd G. wrote:

The point of all the screen shots was to show that all the source code was there, main, and subprograms[...].

Those screen shots convey very little useful information. There are situations where screenshots can be useful, but this is not one of those. All the source files may exist in known places, but until you create a project and specify that such and such files belong to the project, those screenshots represent disconnected vignettes. 

We asked you to provide the source files, if possible, or at least the solution and build-log files. Until you respond to those requests, we cannot help you. 

But it keeps coming back to the same place for some reason

Sorry, since we were not co-travelers, we do not know who "it" is and where "same place" is!

0 Kudos
Steven_L_Intel1
Employee
1,361 Views

A Solution is a container for one or more projects. A project builds a thing in one language, such as an EXE, LIB or DLL. Much of the time you just have one project per solution, but it can get more complicated, especially in a mixed-language application. When you build the solution, it uses the "project dependencies" you specified to determine in which order to build the project(s). The last one typically creates an EXE.

You could start over by selecting FIle > New > New Project. Select Intel Visual Fortran > Console Application > Empty Project. Right click on the project, select Add to Project > Files > Existing and select all your source files. You should then be able to build it.

The reason I asked for the buildlog.htm is that this tells me exactly what Visual Studio tried to do. I also asked for it after a full rebuild, as if you simply click Build it will just try to link whatever it has. The screenshots you tried to provide probably didn't have the needed information.

If you can't provide the source files, then provide the .sln and .vfproj files (in a ZIP), along with the buildlog.htm from the Debug folder after you do Build > Rebuild All.

 

0 Kudos
Boyd_G_1
Beginner
1,361 Views

How do I zip the files?  I used to have (another computer) WinZIP.  But do not see.  I could provide source, but it's 5000 lines.

Let me try Steve's tip.  I started simply copying the source files into another tab every time is said it couldn't find tem.  That seemed to work as now I'm addressing actual FORTRAN errors.  But that seems silly, why would you have to do that?

0 Kudos
mecej4
Honored Contributor III
1,361 Views

There are many Zip utilities, of which 7zip is free: http://www.7-zip.org/. The Windows Explorer itself has some zip/unzip capabilities, see https://support.microsoft.com/en-us/help/14200/windows-compress-uncompress-zip-files . Command line version from Info-Zip: http://www.info-zip.org/Zip.html .

These days, 5000 lines is a trifle.

0 Kudos
Boyd_G_1
Beginner
1,361 Views

I have worked throught the unresolved eferences.  Everytime it identified an unresolved reference, I copied that part of the source code into a new tab.  So now it's a duplicate of the source file, just copied into the new tab.  Now no unresolved references, down to a fortran error, which I can handle.  Why would this be necessary?  Seems crazy.

0 Kudos
Boyd_G_1
Beginner
1,361 Views

Something in my computer will not let me download WinZIP.  I don't even get the option to download or not.  Simply blocked.  Geez.  OK, I'll have to get someone to help me ID what's blocking the downloads so I can delete whatever file is doing that.  

0 Kudos
Reply