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 MINGW32_NT-6.2 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<char> &)" (?getKnownFolderPath at path@sys at llvm@@YA_N U_GUID@@AEAV?$SmallVectorImpl at D@3@@Z) 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. -- http://justinmchase.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151113/fedeca42/attachment.html>
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? Regards Senthil On Sat, Nov 14, 2015 at 9:57 AM, justin chase via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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 > MINGW32_NT-6.2 > > 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<char> &)" (?getKnownFolderPath at path@sys at llvm@@YA_N > U_GUID@@AEAV?$SmallVectorImpl at D@3@@Z) > 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. > > > -- > http://justinmchase.com > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151114/3062a20d/attachment.html>
Yeah! 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? On Fri, Nov 13, 2015 at 10:31 PM, Senthil Kumar <senthil.thecoder at gmail.com> wrote:> 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? > > Regards > Senthil > > On Sat, Nov 14, 2015 at 9:57 AM, justin chase via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> 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 >> MINGW32_NT-6.2 >> >> 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<char> &)" (?getKnownFolderPath at path@sys at llvm@@YA_N >> U_GUID@@AEAV?$SmallVectorImpl at D@3@@Z) >> 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. >> >> >> -- >> http://justinmchase.com >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-- http://justinmchase.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151113/0b808c7c/attachment.html>