Linking Assimp 3.1.1 in Visual Studio 2015 - c++

I am linking to assimp as i´ve always done with other middleware, but when i run my application, i get a runtime error: "Application could not launch correctly (0xc000007b)."
What am i missing? I downloaded the assimp 3.1.1 binary and got
an include/assimp folder, containing header files and a "Compiler" folder containing more headers
"lib32" and "lib64" folders, each containing an "assimp.lib"
"bin32" and "bin64" folders, containing an "assimp.dll" and an "assimp.exe"
...along with other folders and files, like samples and cmake stuff.
I put the "include/assimp" folder into my projects include folder, the assimp.lib i put in my lib/x86 folder and the assimp.dll and .exe next to my application .exe.
In my startup-project´s properties i am linking to the include and library paths and i am including assimp.lib in my additional dependencies.

The problem was that the assimp.dll and assimp.exe had to go into my solution folder. appearently somewhere this is defined as the place to read .dll or .exe from.. even though thats strange because my glew.dll and sdl2.dll need to be inside the same directory as my application.. Probably the assimp.exe assumes the .dll is in the directory above it

Related

Visual Studio C++ how to add header files in a prefix folder

I cloned a github C++ repository. The repository is not a VS project. So I manually created a VS C++ blank project and added the files from the repo to the project. The files are not copied. This is not the problem.
The repo directory looks like this:
include\NTL\*.h
src\*.cpp
*.h means a bunch of header files and *.cpp means a bunch of .cpp source files.
The problem is that the .cpp files have #include <NTL/*.h> and when I build, VS fails to locate the header files (No such file or directory). Adding the path to the include to the Include Directories in project properties didn't help.
EDIT: After some experimenting, I've found that the error has nothing to do with the prefix NTL in #include <NTL/*.h> but with whether the files are copied into project directory. Even though the files appear in VS project view, they must be copied into the project directory.
EDIT: The only way I've managed to get the project to compile is to put the whole NTL directory containing header files in project directory. Include Directories and Additional Include Directories in project properties don't seem to have any effect.
All previous No such file or directory errors were the result of some combination of:
Mismatching project properties Configuration and Platform
Some .h files were actually missing from NTL github repo, e.g. mach_desc.h.
The solution to the problem consists of the following:
Under project Properties > C/C++, add the path to the include to Additional Include Directories.
VS project has a separate set of properties for each combination of Configuration and Platform. Make sure that step 1 applies to the active Configuration and Platform. E.g. If the project's currently configured to build for Debug x64 (active Configuration:Debug and Platform:x64), make sure that step 1 applies to Debug x64, and not something like Release Win32 or Release x64, etc.
Use the Windows/Linux-specific zip package from the Downloads page of the official website https://libntl.org/download.html

assimp-vc140-mt.dll ASSIMP was not found

I have downloaded the Assimp project from http://assimp.sourceforge.net/main_downloads.html
Assimp release image
assimp zip image
And I've also downloaded the cmake x86 version from this link: https://cmake.org/download/
cmake x86 image
I have extracted both, and made a build folder next to the assimp's folder.
After that I have opened a command promt, changed the directory to the mentioned build folder. I gave the cmake.exe's path to the command promt and the assimp folder's path as the first parameter. After that I had the visual studio solution in the build folder.
I have made an assimp folder in my openGL project. In this assimp folder I've created a lib folder and I put everything from the build/code/debug folder into it, namely:
assimp-vc140-mt.dll
assimp-vc140-mt.exp
assimp-vc140-mt.ilk
assimp-vc140-mt.lib
assimp-vc140-mt.pdb
After that I copied the include folder from the downloaded assimp folder next to the previously mentioned lib folder.
So now I have all the libs and includes inside my openGl project
I have set the additional include directories, the additional libraries and the additional dependencies in the visual studio for my openGl project
In my main.cpp I have included these headers:
include "assimp/Importer.hpp"
include "assimp/scene.h"
include "assimp/postprocess.h"
I can build my project and run it.
But when I run it after the console appears I immediately get this error:
assimp-vc140-mt.dll was not found
I don't know what could be the source of the error, do you have any idea?
Thank you in advance!
Don't forget dependant DLLs which are not system DLLs are loaded from application directory and from current directory - to me it sounds like you haven't put assimp-vc140-mt.dll in either of those.

Cannot open source file in visual studio 2015

I am trying to compile OBS studio with this tutorial in windows using Visual Studio Community 2015. I have created a project in visual studio and copied the entire git repo into the project by dragging the files into the solution explorer. This project has dependencies on libav, x264, and curl. They are given as .lib, .dll, and header files.
The problem is I keep getting "cannot open source file". I have the the header files in a separate folder from the dll's and lib's (dll and lib are in the same folder). Under the project settings->VC++ Directories I added the include directory, and also added the library directory. Then I added the lib's specifically under Linker->input->additional Dependencies. Then I added the directory that contains the .dll files to the environment variable PATH.
After all this, I still keep getting the same error, as well as a few other errors. Here is a screen shot of one source file that has the issue.
These are my settings.
For the path, I have tried with and without the trailing forward slash.
EDIT:
Use the C/C++ settings instead of VC++ settings for additional include directories.
What is probably holding you up is that those folder icons in the VS sidebar are not actually related to the file system. They are filters and don't change depending on the actual directory.
This is another explanation for Drop's suggestion -- check to see if the files are really where you think they are.
In my case I already added the include libraries but that was not enough. The error went away once I switched the configuration from x86 to x64 in Project Properties.

Adding my DLL into a Visual Studio project in C++

I am working on a project that involves making a dynamic link library, so I want to test it in a console app in Visual Studio.
The DLL is also made in Visual Studio, it doesn't have much, just a few functions in it. I'm not sure if I'm just supposed to include the librarys header in the include directories panel in Properties, or do something else
A lot of people say I'm supposed to add its corresponding .lib file in the Library or Reference directory, but I'm not sure that VS generates a .lib file alongside the DLL. I'm using VS 2015.
I don't have VS in front of me this very moment, but these should be the general steps to set it up:
Properties->Linker->Input: your.lib
Properties->Linker->Additional Library Directories: ../your/bin
Properties->General->Compiler->Additional Include Directories: ../your/include
To build your app, the DLL's API headers must be in the include for the compile-time, it's LIB files in the bin for the link-time. Once you have your app EXE, all you need is the DLL to be in the same folder as your EXE when it executes.
You might also want to add the dll project and the app project into a common solution in VS and add (right click) Project Dependency from the app to the dll. This ensures correct order of building, assuming you are going to build the dll at all.
You can also do what I did.
You can create a Libs directory inside of your Solution directory.
You can then place your .DLL files inside of the Libs directory or some sub-directory inside of Libs
In my case, I added the entire SFML-2.3.2 directory in there, which included the source-code, .lib files, and .dll files.
I did link up what I could in the project properties, but I used Visual Studio's macros to fill in the path name to the Solution directory. Just in case I wanted to put this in version control and work on it from multiple machines.
Then I opened up the Project's Property Page.
Within the property page, I went to Build Events -> Post-Build Event -> Command Line
Within the Command Line, you can add a copy command that will copy any needed files into the same directory as the executable that will need them.
In my case I used: copy "$(SolutionDir)Libs\SFML-2.3.2\bin\*" "$(TargetDir)"
I could have written multiple commands to copy just the individual files that I needed, but I had spent a good three hours trying to get SFML to work without actually installing it.

VS2012: Program can't start because "libvorbisfile.dll" is missing

I've got a project and I'm trying to make it read a .OGG file.
I've downloaded the libogg and libvorbis from here, compiled them (had some trouble figuring I had to build libogg first), then got the following files:
libogg.lib
libogg.dll
libvorbis.lib
libvorbis.dll
libvorbisfile.lib
libvorbisfile.dll
I dragged all of them in my project's Libraries folder, already added to the project, and included them in the Linker->Input (only the .lib).
Next I copied the headers to my project's Includes folder, also already added to the project, with the files:
ogg/ogg.h
ogg/os_types.h
vorbis/codec.h
vorbis/vorbisenc.h
vorbis/vorbisfile.h
Then I added some code, and I get the error "The program can't start because libvorbisfile.dll is missing from the computer."
And I'm pretty sure the file IS in the Library folder and properly defined in the properties.
Did I do something wrong along the way?
How can I figure what is wrong so I can fix it?
I already tried putting the .dll in the project's folder and in the Windows/System32 folder as well, didn't work.
The library folder is fine for your .lib files, but it's looking for the .dll at run time, which your project settings have no effect on. Windows looks in a few places for a .dll, but the easiest way to get your program to run is to put the .dlls in your working directory, which is where ever you run your executable from (probably the same directory as the .exe file).