Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29260 ディスカッション

VS2015 How to Prevent Linking

chauvjo
初心者
941件の閲覧回数

In VS2015, how do I configure my project to prevent linking (i.e. only create object files)?  I have tried using the /c option but VS2015 is still is giving linking errors:

fatal error LNK1120: 1 unresolved externals
error LNK2019: unresolved external symbol _MAIN__ referenced in function _main

Thanks...

0 件の賞賛
6 返答(返信)
Kevin_D_Intel
従業員
941件の閲覧回数

For a single source file, under the Solution Explorer one can right-click and select Compile, or left-click on the source file to set the focus and then use Ctrl-F7.

For a project, under the Solution Explorer one can right-click on the Project, then under Project Only select Build Only, or via the Build menu pull-down do the same; however, this is not functioning as expected with Intel Fortran projects. I’m currently using our PSXE 2017 Fortran integrations (Version 17.0.0036.11 ) with MSVS and this build selection is both compiling and linking with a Fortran project. It behaves as expected with a C/C++ project, compiling the project only.

Unfortunately I could not find a work around.

Steven_L_Intel1
従業員
941件の閲覧回数

Create your project as a "Static Library" project rather than Console Application, etc.

Kevin_D_Intel
従業員
941件の閲覧回数

Actually, it turns out this isn't behaving for C++ projects either so I may have the wrong impression of this Build Only option. I'll discuss this w/Development.

Steven_L_Intel1
従業員
941件の閲覧回数

Build Only works fine - but if your project is an executable (or DLL) project, it will link. That's why I suggested using a Static Library project when you have no main program.

Kevin_D_Intel
従業員
941件の閲覧回数

Steve is correct. Development confirmed that for Build Only, if the build normally includes compilation and linking, then both are performed.

mecej4
名誉コントリビューター III
941件の閲覧回数

Even for a static library project, the build process probably calls LIB.EXE as the last step, although this is unnecessary if no static library is desired. The extra time consumed, however, is probably small. Perhaps there has been little demand for an objects-only project and so there is no corresponding VS template for it.

返信