Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1 View

LNK2019 Error

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
Highlighted
1 View

It would be helpful to see

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.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

Thank you Mr. Lionel.  Past

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
Highlighted
1 View

The build log will show all

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.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

 

[Deleted by Steve L - non-useful references to PC-local files]
0 Kudos
Highlighted
Beginner
1 View

screen shots attached.  build

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

0 Kudos
Highlighted
Beginner
1 View

Tried to attach screen shots,

Tried to attach screen shots, build log last shot

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

0 Kudos
Highlighted
Black Belt
1 View

You have tried to include

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
Highlighted
1 View

I deleted the broken

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

As I said above, screenshots are not useful.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

Attached just the Build Log

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

0 Kudos
Highlighted
1 View

This is still not what we

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.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

Thank you.  The point of all

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
Highlighted
Black Belt
1 View

Quote:Boyd G. wrote:

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
Highlighted
1 View

A Solution is a container for

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.

 

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

How do I zip the files?  I

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
Highlighted
Black Belt
1 View

There are many Zip utilities,

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
Highlighted
Beginner
1 View

I have worked throught the

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
Highlighted
Beginner
1 View

Something in my computer will

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