CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    MSB4018 - does the linker have an equivalent of STRICT ?

    I'm building a library called AAF. I built it once with VS2005 and didn't have any problems but when I try to build with VS2015, the Release versions gives me these errors at the linker stage:-

    Code:
    error MSB4018: The "Link" task failed unexpectedly.
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.CPPTasks.Link.ForcedRebuildRequired()
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ComputeOutOfDateSources()
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.SkipTaskExecution()
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.Utilities.ToolTask.Execute()
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(638,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
    I did some research and discovered that this can be caused by the linker not being able to create a target folder for the output files. However, that doesn't seem to be the case here. For both 32-bit and 64-bit the Debug versions both compile and link fine - but both Release builds fail. I just wondered if some warning is getting treated as an error somehow? (although I don't actually see any warnings when building the Debug builds... )
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: MSB4018 - does the linker have an equivalent of STRICT ?

    Did you 'upgrade' the VS2005 solution to VS2015? That could be the cause of the error - which is often associated with project files containing missing/unexpected values. Is Linker/Output File value correct in the release builds? The properties for debug/release and 32/64 bit builds are separate and have different values and need to be set for each. As a last resort have you tried re-creating a new solution from scratch?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: MSB4018 - does the linker have an equivalent of STRICT ?

    The library contains different project/solution files for VS2005 and VS2015. I just went back to VS2005 temporarily and it still builds okay. I guess I'll have to experiment with the VS2015 linker settings to see if anything makes a difference. If not, I'll try rebuilding the project from scratch.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured