I am trying to "compile without linking" a code meant to be used as multithreaded .dll in future. I am using VS 2019 for the same. Here is the command that I have used:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX64\x86\cl.exe" /c /MD "C:\SpiceOpus\bin\ifspec.c"
This returns the following response:
ifspec.c c1: fatal error C1356: unable to find mspdbcore.dll
This file is however present in the following 3 locations in my system as confirmed by using dir /s mspdbcore.dll :
A)
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE
B)
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64
C)
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86
Thus, I would like to know how to instruct the compiler for the presence of these files and then use them. I have tried using /l option for doing this as shown :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX64\x86\cl.exe" /c /MD /L "C:\SpiceOpus\bin\ifspec.c"
But it says :
cl : Command line warning D9002 : ignoring unknown option '/L'
Please feel free to correct / suggest an alternative path. Kindly consider me as layman in coding things. I am in EE with not much experience in these coding stuff. Thank You.
--------------------------- Regarding PATH-----------------
Path=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools;
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86\cl.exe"
This evokes the following response:
Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27525 for x86 Copyright (C) Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ]
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86\cl.exe;%PATH%
PATH gets modified but using cl command (in administrator developer cmd prompt of course ) again says that it's not recognized.
I have already repaired the installation for BuildTools using its installer. cl.exe works for sure or how else do you get the response given in point 2,5. Please let me know why cl doesn't work but writing the command in point 2 gives results? Secondly, the modified PATH variable gets restored to the original one after every reboot. How do I avoid this?
So in summary this is where I am stuck now: I have figured out that the following code seems to work partly :
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86\cl.exe" /I "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" /I "C:\SpiceOpus\source\include" "C:\SpiceOpus\bin\cfunc.c" /c /MD "C:\SpiceOpus\bin\cfunc.c"
But it just says it is generating code........ I can't find any object file from it.
I got this error when trying to run dumpbin.exe from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x86
with either the /HEADERS or /ALL flags on a 64 bit machine.
The fix was to cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64
and then dumpbin /HEADERS "c:\Program Files (x86)\PostgreSQL\10\pgAdmin 4\bin\libpq.dll"
worked.
Since this was at the top of the search list for this error message, I wanted to report the fix.
using Visual Studio Installer, you'll want to:
After installation completes, you can re-run your cargo install
or whatever gave you that error message and it should work. I didn't have to reboot or re-open a terminal/command prompt, it just worked once I installed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With