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.
Related
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
I downloaded the xlnt library for working with Excel - https://github.com/tfussell/xlnt. Can you please tell me what to do with it further? Honestly, I still can’t understand how among all the files there are in the downloaded archive, and there are 100 of them .hpp and .cpp files, what should I do with them?
1)As far as I understand, they need to be processed by the Cmake program and it seems that the output should appear .lib file, but I absolutely can’t understand how to do it or maybe something else
2)Or how can they be directly processed by Visual Studio 2017?
PS:When I launch Smack, I select the Source folder, the Cmake generates many incomprehensible files, but among them there is not one file with the .lib extension.
Help me please.
With CMake you can obtain the visual studio 2017 project files
and then compile the xlnt library.
Unzip the archive file
Within the xlnt folder, create a new directory and call it build
Launche CMake (GUI)
Browse for the source code folder
Browse for the build folder xlnt/build
With the Configure button select the tool (IDE/compiler) that you want to use
Pressing the Generate button, CMake will generate (inside the build folder)
the visual studio 2017 project files you need to compile the xlnt library
Building the solution, VS 2017 produces the xlnt.lib, xlnt.exp and xlnt.dll files.
The source path you see in the CMake screenshot is incorrect. You must specify the path that contains the "top level" CMakeLists.txt file.
The correct directory is: C:/Users/Zver/source/repos/XLNT Library/xlnt-master.
The CMakeLists.txt file in the above directory tells CMake all necessary subdirectories.
At this point you will see the static compilation option of the library appear.
If you use the MinGW/GCC compiler you must prevent the path from containing empty spaces.
Then you need to rename the directory from "XLNT Library" to "XLNTLibrary". At this point the path would become:
C:/Users/Zver/source/repos/XLNTLibrary/xlnt-master.
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
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.
I believe I have followed every instructions given, so I just have to ask the same question again.
I am trying to use libcurl.
I have changed the following settings in my project:
Configuation Properties|VC++ Directories|Library Directories - here I have put the folder where the .lib file is found. I did this for Debug, Release and All Configurations.
Configuation Properties|VC++ Directories|Include Directories - here I have put the folder where the .h files are found. I did this for Debug, Release and All Configurations.
Configuration Properties|Linker|Input|Additional Dependencies - I have added the .lib file. I did this for Release, Debug and All Configurations.
Configuration Properties|Linker|General|Additional Library Directories- I have added the folder where the .lib file is located. I did this for Release, Debug and All Configurations.
The program builds well without any errors.
When running the .exe file, I get the error message:
.dll is missing from your computer.
I have put the .lib file in the same folder as the .exe file, but that does not help. In fact I have put the .lib file in all folders for my project, but the computer can't find them anyway.
How can this be explained?
Is it possible to build the program without errors if the .lib file is simply wrong? I use a win32 .lib file and I create a Win32 project, but I'm running on a Win64 PC. Does that matter?
Desperate for help. Been searching like crazy for three days now.
Bests,
You have to put the "libcurl.dll" in the same folder as your executable (DEBUG or RELEASE). In case of debugging, the dll is expected in your Project folder because Visual Studio is setting that directory. The ".lib" file is only necessary on compile time, which is already successful in your case.
The DLL comes with the cURL Projekt or is build when building the lib. Usually you will find the DLL near the directory of the lib. Search for a "bin" folder.
If you use the 32 bit version, make sure that you use the 32 Version of the DLL. The DLL has to match with the EXE, not with the OS.