I am trying to link LLVM to my C++ project (using Visual Studio 2022), using Zig's pre-built binaries.
I have found libclang.dll in the bin folder however I am unsure how I can link this to my project.
I am hoping to do something like this:
int main()
{
LLVMCompileProject(dependencies);
}
Before someone suggests this, i am intentionally evoiding using system and am trying to directly use LVM.
Related
I am trying to create static program in Visual Studio, where I end up with a single executable that I can deploy to other PCs.
I am using VCPKG to static download libraries, as per the instructions here:
https://devblogs.microsoft.com/cppblog/vcpkg-updates-static-linking-is-now-available/
In the following post, the answer to the question is to use VCPKG and then CMAKE
Using Cmake to build ssh.dll with Visual Studio 2017
My question is with regards Cmake. If VCPKG downloads and creates folders that my project links to. What's Cmake for and why would I need to use it?
What's Cmake for and why would I need to use it?
https://cmake.org/ read the text below the logo.
It can be used to generate a project files for different build system, like make, msbuild, ninja etc.
It also can be used as a general scripting language.
You don't need to use it but it is highly encouraged for consuming other dependencies.
vcpkg however will download cmake since it is used as a scripting language within vcpkg.
I have installed both tesseract:x64-windows and tesseract:x64-windows-static via vcpkg. In my Visual Studio project, I can #include <tesseract/baseapi.h> and it will automagically compile but I have no idea whether the static or dynamic version of the library is being linked and I also have no idea how to switch between them. What setting lets me see / change that?
For VS integration you could try out PR https://github.com/microsoft/vcpkg/pull/4361 or just set the MSBuild property VcpkgTriplet according to:
https://github.com/microsoft/vcpkg/blob/master/docs/users/buildsystems/msbuild-integration.md
How are you?
I am trying to create a video like this:
https://youtu.be/L0JkjIwz2II
or like this:
https://youtu.be/hPCTwxF0qf4
I am trying to getting this code working:
https://github.com/Tubeliar/HAARCascadeVisualization
I am using Visual Studio 2017 on Windows 10.
I have added correctly the include directory and the library directory.
I created it as a console application.
I added the #include "stdafx.h" at the start of the main file.
This are the errors that Microsoft Visual Studio show to me:
Can you help me solve this?
There is anything that I should know for making this work correctly?
Thank you to everyone,
Andrea
Those errors are as has been noted indeed linker errors. If the compiler does not complain that means you have you include paths set up correctly, so you have won half the battle.
For linker errors you can try these things:
Make sure your *.lib files are built for the same target you're building your own project for.
If you use NuGet then you can look in the /packages folder of your project. Browse down to /packages/[package name]/build/native/lib/[architecture]/. There you will find folders like v120 or v140. For Visual Studio 2017 they need to be v141. If they are missing then you can tell VS to target the older platform (project properties -> general -> platform toolset)
If you've built the libraries yourself then maybe you did that similarly targeting a different platform? Try building the OpenCV library again and make sure the target is set to v141 (or whatever you want to use).
Make sure the linker can find your libraries. If you're using NuGet this step isn't necessary but if you built the library yourself or if you downloaded a prebuilt one then go into project settings and:
Go to VC++ directories -> Library Directories, edit that value and make sure the folder that contains the *.lib files is in there.
Go to Linker -> Input -> Additional Dependencies, edit it and put in all the *.lib files. Just their names, not full paths. In your case you'd just put opencv_world331d.lib there.
Be aware that any of the above settings need to be done for each configuration. Usually there is a x86 and x64 architecture combined with debug or release configuration. If you switch any of these you'd have to check the above steps again. This is a bit of a hassle so you're better off defining a property sheet once which you can then reuse every time you do a OpenCV project. There was a tutorial for this in OpenCV 2.4's documentation, and some people have made premade ones.
I have a communication library built on top of Qt and Google Protocol Buffers. It's currently being built with MinGW/GCC on Windows. My goal is to use the same library in C# on .NET, with the help of a thin wrapper on top using C++/CLI (bridging the unmanaged code with managed code).
I tried using the MinGW produced DLL directly in my C++/CLI project, but I keep getting linker errors (cant remember the error codes right now, but something about missing tokens and functions/signatures).
First question is: Should I be able to use the MinGW-produced DLL with the Visual Studio compiler/linker? Or do I need to compile the library again, using only VS compiler for all projects?
If I should be able to use the MinGW-produced DLL directly, how do I reference it in Visual Studio 2010? In project settings it seems to look for *.lib files, but I can't find any .lib files in the output of MinGW/GCC. It does produce *.a files, but it seems like Visual Studio don't handle this kind of file..
I should also mention that both Qt and protobuf are also compiled with MinGW. But I can of course recompile all the parts in VS 2010 if necessary.. Would have been nice to save the recompile time though, since our buildserver already has a working setup using MinGW.
The easiest way to use it would be by recompiling it with Visual Studio. This is when I am assuming C++ types and classes used in the interface you intend to use.
In case you have a C interface to this library you could dynamically load the library via LoadLibrary and use GetProcAddress to access those functions.
However it depends completly on the way how you intend to use the library.
Assume I have source code for a lib/tool that works on gcc compiler. Can I use the same code and compile it in visual studio. will that be possible at all? If it is possible, how do I do it?
if you are just using all the standard C/C++ library like stdio.h, stdlib.h, etc. it should work fine. Pure console program should work fine. If you used some GUI related library (especially if you are porting over from unix to window) then it might not work.
To do so, you can simply just create a new project in visual studio and add the existing source code into the project workspace. Compile it, if you encounter any error, just post here or try solve if you know how
It depends on your code, GCC support a variant of C (C99) which Visual Studio doesn't support yet.
If your trying to compile a Unix program on Windows you best bet will be to use Cygwin.
Check this question for pointers on using Cygwin in Visual Studio.