Visual Studio not able to run ".lib" file? - visual-studio-2010

I am trying to build a project from the following Source Code (it accompanies a book I am currently reading). Unfortunately, visual studio can not run a library with the name "cyclone_d.lib". I believe this is because visual studio simply can not locate the file. I have spent several hours trying to fix this problem by changing the settings in the linker and project, for example adding Additional Directories, but I have not been able to get any results.
Please let me know how I can fix this problem and compile the code.
Thank You!

Your link to source points only to some Unix-style source files but no VS project files. So I can only guess and give general help.
A VS solution contains one or more projects. Each project has a build target, in most cases a EXE, DLL, or static library LIB. When you have a solution that includes an project with an EXE build target set the option "Set as StartUp Project" at that project in the solution tree.
If you don't have an EXE change your project setup to create a Win32 executable instead a library. For this task the most simple approach is creating a new project (Win32 Console Application or Win32 Project) and add all the source files.

Related

Visual Studio 2017 How to add missing dll to C++ project?

I have a Visual Studio 2017 C++ project which depends on ffmpeg libraries. As of now it crashes at run time because of the missing dependency avformat-58.dll. I've tried adding this file into the project by dragging it into my project but that does not suffice. I tried looking at the Add Reference screen but it is empty. What can I do?
On the advice of #HansPassant I added the dll(s) to the project as existing external files. I think there should now be an option somewhere to "Copy to output directory" but I'm not seeing it. Here is what I see when I open property pages of one of the dlls.
#sellotape Here is a screenshot of the window when I just single click.
According to this documentation https://learn.microsoft.com/en-us/windows/desktop/Dlls/dynamic-link-library-search-order I can copy the necessary dlls to any directory in the PATH environment variable. There were many dlls already in C:/Windows/System32 already so I just put the ffmpeg dlls there as well and the executable runs.

How to link a static library in Visual C++ 2017?

Trying to set up libtins on windows. Im relatively new to Visual studio and most of the documentation on the matter was for older versions. I was able to get the include files set up with the project but linking the .lib's was problematic and i cant seem to configure it properly. The properties menu seems pretty convoluted as im used to doing most things compiler related configurations from a command line.
In the Solution Explorer, right click on the project, select Properties. Expand to Configuration Properties > Linker > Input. Add the .lib file to Additional Dependencies. Do this for both the Release and Debug configuration.
If the static library in question is in fact the output of another visual studio project, you can just add that project to your solution file, and then add a reference to that project, and let VS2017 figure out where the lib files are located, and that the linker needs them.
i.e.
Solution '...' (2 projects)
Lib Consuming Project
References(Lib Producing Project)
Lib Producing Project
hint for creating static libraries from visual studio
for Lib Producing Project, go to Properties
Properties->Configuration Properties->General
and set Configuration Type to static lib (for both debug and release)
for foreign static libs, the accepted answer is AFAIK the proper way to do it.

I need to create a sample video to visualize how HaarCascade works on OpenCV (code do not works)

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.

TypeScript compilation outside of project created with Visual Studio

I have inherited a large LOB application that is built using TypeScript. The project has no reference paths in any of the files due to the fact it has been setup and created using Visual Studio 2013 - Visual Studio seems to have some magic where it will pick up the global TypeMaps itself. scoff.
The current build process has been to use Grunt to copy the compiled .js files (which are generated on save in Visual Studio) to a build directory - not actually compile them.
(to further reinforce this point, Grunt is NOT compiling any TypeScript).
This build process is now no longer acceptable as I am moving the application to a build through a Continuous Integration process, using Team City and Command Line tsc.exe/Grunt - so when the repository is checked out there are obviously no generated .js files in the project.
In its current state there is a host of compilation errors when trying to use Command Line tsc.exe/Grunt to compile the TypeScript files, I think due to the fact that the application is not using reference paths?
Does this mean I'm going to need to add all of the relevant reference paths to each file in the project?
Has anyone got any experience regarding this kind of setup and could point me in the right direction to manage these reference paths and build process?
Thanks
In its current state there is a host of compilation errors when trying to use Command Line tsc.exe/Grunt to compile the TypeScript files, I think due to the fact that the application is not using reference paths
No. You should use a tsconfig.json which will create the compilation context.
More
https://basarat.gitbooks.io/typescript/content/docs/project/project.html
A solution has been found.
Using the Visual Studio configuration options in the grunt-ts task I have setup the task to specifically use the projects .csprog and TypeScript 1.4 compiler (we are locked into this compiler).
My configuration for the grunt-ts task:
ts: {
default: {
vs: "Consortium.Client.Web.csproj",
options: {
compiler: "1.4/tsc"
}
}
}
I hope on the off chance, this helps someone else.

Compile VxWorks project in Visual Studio

I have a VxWorks project that compiles under Toronado on my Win7 machine. I am trying to convert the same project to compile in my Visual Studio 2010. I don't need it to complete to where it creates a .o/out file but at least get through all the defines/includes and etc. so I can use Visual Studio's IDE for definition jumping and etc..
I'm at a point where I'm getting a 'undeclared identifier' for "_interrupt" which is included in several include files from the ..\tornado\target\config\ folder.
I'd appreciate any suggestions
Thanks
I would like to comment on this but don't have enough points.
I do the same thing using eclipse instead of visual studio, I don't do anything special to make it work.
It sounds like you are trying to do the link even though you don't want to. Make sure when you create your project you set it up to create a library not an executable, it should do the compile then but no linking.

Resources