(no subject)

Hello all!

Please forgive me if this is the wrong mailing list for my question.

First off, I am on Windows and using git bash for everything:

$ uname

I am attempting to essentially do the kalidescope example. I have copied the code verbatim from the full code listing and am running the following command:

$ clang-cl toy.cpp deps/llvm/build/Debug/lib/*.lib //MDd -o toy.exe -I deps/llvm/include

Which results in this error:

LLVMSupport.lib(Path.obj) : error LNK2019: unresolved external symbol __imp_CoTaskMemFree referenced in function “bool __cdecl
llvm::sys::path::getKnownFolderPath(struct _GUID,class llvm::SmallVectorImpl &)” (?getKnownFolderPath@path@sys@llvm@@YA_N
toy.exe : fatal error LNK1120: 1 unresolved externals

I’ve tried simplifying things but no matter what I do that is the error I get. So I’m assuming I’m not building llvm correctly. Here is essentially what I’m doing:

$ cd deps
$ git clone http://llvm.org/git/llvm.git
$ mkdir llvm/build && cd llvm/build
$ cmake … -G “Visual Studio 2012 Win64”
$ cmake --build .

That builds for quite a while but eventually appears to succeed without any errors. I had to manually copy a few files that were transformed but not copied to where there were expected to be but after figuring that my code appears to compile except for the missing getKnowFolderPath function.

What’s really strange is that I see that function in the code, Path.inc. I can’t seem to figure out why this function would be unresolvable.

Can anyone here help me figure out what I’m doing wrong? I’m assuming there is some define or other flag that I need to specify to get linking correctly.

AFAICT, the linker is complaining that it cannot find CoTaskMemFree. Did you try adding Ole32.lib (https://msdn.microsoft.com/en-us/library/windows/desktop/ms680722(v=vs.85).aspx) to the list of libraries the linker looks at?



I’m blind apparently. I’ve been staring at that for a while and didn’t realize it was saying the other symbol was unresolved. I changed my command to this and now it works:

$ clang-cl toy.cpp deps/llvm/build/Debug/lib/*.lib //MDd -o toy.exe -I deps/llvm/include /c/Program\ Files\ (x86)/Microsoft\ SDKs/Windows/v7.1A/Lib/x64/Ole32.lib

clang-cl appears to add a number of default include and -libpath dirs by default. Is there a special way to get it to add available sdk dirs by default or is this basically the right way?