- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create your project as a "Static Library" project rather than Console Application, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve is correct. Development confirmed that for Build Only, if the build normally includes compilation and linking, then both are performed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page