I found this old post:
Using the gpgme library from .NET?
but it can't help me to link my C++ project (Visual Studio) to libgpgme-11.dll.
I am using Windows 10 platform, and have done the followings to try to set it up:
Properties->Linker->Input: libgpgme-11.dll
Properties->Linker->Additional Library Directories: Gpg4win\lib and Gpg4win\bin_64
Properties->C/C++ General->Additional Include Directories: Gpg4win\include
When I compiled the project, I got an Link error LNK1107 invalid or corrupt file: can not read at 0x368.
It seems to me that the libgpgme-11.dll is not the correct one to link against. Yet, I don't find any gpgme lib files under the root Gpg4win folder.
Any recommendation ?
Eric
There are three things to do in setting gpgme in Visual Studio:
Add "Gpg4win\include" to the "Additional Include Directories" property
Add "Gpg4win\bin and Gpg4win\lib" to the "Additional Library Directories" property
Add "libgpgme.imp" to the "Additional Dependencies" property
The Additional Library Directories and Additional Dependencies properties are under Linker's General and Input tabs. The Additional Include Directories property is under C/C++ General tab.
Hope this saves someone else's time.
Related
I am trying to compile and build the first basic example from the OSG 3.0 Beginner's Guide (Rui Wang, Xuelei Qian) run on Windows 10 (Build 18363) with Visual Studio Community 19 (16.7.3).
The code looks like this:
#include <osgDBd/ReadFile>
#include <osgViewerd/Viewer> //the "d" is supposed to be there when in Debug solution configuration
int main(int argc, char** argv)
{
osgViewer::Viewer viewer;
viewer.setSceneData(osgDB::readNodeFile("cessna.osg"));
return viewer.run();
}
But the error messages are:
Error (active) E1696 cannot open source file "osgDBd/ReadFile"
Error (active) E1696 cannot open source file "osgViewerd/Viewer"
Error C1083 Cannot open include file: 'osgDBd/ReadFile': No such file or directory
So I rechecked my solution properties, which I had set up following OSG's online documentation "compiling with visual studio" (Linker, C++ properties, ...), as well as my environment variables in Windows OS.
The recommended cmd commands, should something be out of order, didn't help either.
(I deemed it less cluttered leaving out all those screenshots, but I can of course upload them if wished)
I also compared my settings to this answer: How to add additional libraries to Visual Studio project? , which I thought same.
I should add, that I built OSG on a separate drive than Visual Studio or Windows, but I believed setting the environment variables properly should be ok.
Help would be greatly appreciated.
Thank you.
Have you set %OSG_ROOT% ?
I'm not sure what is in the guide, but my typical installation is to set Windows environment variable OSG_ROOT to the main OpenSceneGraph folder in my Program Files (x86), then to add $(OSG_ROOT)\include to my additional include folders and $(OSG_ROOT)\lib to my additional library folders.
Also, it looks like the example you are using has a "d" added to the folder names - should just be osgDB/ReadFile and osgViewer/Viewer for the Release versions - maybe they wanted you to build the debug libraries and add such folders for your includes? I get having a separate lib and bin but I don't know why they would want a separate include folder for Debug vs. Release, so my suggestion would be to remove the d from the include statements, e.g. osgDBd --> osgDB, osgViewerd --> osgViewer, etc.
Unfortunately, the Example applications in the OSG Solution reference the local build folders, not the installed folders, so will not serve as an example of how to reference OSG from its installed location. However, if you are ok building from the local build folder, you could just use the project settings from one of the Examples.
I have a problem when trying to debug a simple PCL (Point-Cloud-Library Application) application in MS Visual C++ 2010 that has to visualize a point cloud. (This example: http://pointclouds.org/documentation/tutorials/pcl_visualizer.php)
I setup the C++ project with all the include and library folders needed for PCL.
I add to the linker input the following dependencies:
openNI.lib
libboost_system-vc100-mt-gd-1_49.lib
libboost_filesystem-vc100-mt-gd-1_49.lib
libboost_thread-vc100-mt-gd-1_49.lib
libboost_date_time-vc100-mt-gd-1_49.lib
libboost_iostreams-vc100-mt-gd-1_49.lib
pcl_common_debug.lib pcl_apps_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_debug.lib
pcl_octree_debug.lib
pcl_registration_debug.lib
pcl_sample_consensus_debug.lib
pcl_search_debug.lib
pcl_segmentation_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
vtkRendering-gd.lib
QVTK-gd.lib
vtkalglib-gd.lib
vtkCharts-gd.lib
vtkCommon-gd.lib
vtkDICOMParser-gd.lib
vtkexoIIc-gd.lib
vtkexpat-gd.lib
vtkFiltering-gd.lib
vtkfreetype-gd.lib
vtkftgl-gd.lib
vtkGenericFiltering-gd.lib
vtkGeovis-gd.lib
vtkGraphics-gd.lib
vtkhdf5-gd.lib
vtkHybrid-gd.lib
vtkImaging-gd.lib
vtkInfovis-gd.lib
vtkIO-gd.lib
vtkjpeg-gd.lib
vtklibxml2-gd.lib
vtkmetaio-gd.lib
vtkNetCDF_cxx-gd.lib
vtkNetCDF-gd.lib
vtkpng-gd.lib
vtkproj4-gd.lib
vtksqlite-gd.lib
vtksys-gd.lib
vtktiff-gd.lib
vtkverdict-gd.lib
vtkViews-gd.lib
vtkVolumeRendering-gd.lib
vtkWidgets-gd.lib
vtkzlib-gd.lib
OpenGL32.Lib
When i start debugging the IDE ends up with the following link error:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-sgd-1_49.lib'
The library "libboost_thread-vc100-mt-sgd-1_49.lib" is not contained in the set of boost library of the 3party folder of PCL. What am I doing wrong? Is there another path for VS2010 configuration for PCL programs?
Additional information:
I downloaded last version 1.6 of PCL, choosing the MSVC2010 version all-in-one.
I set up the code generation with /MTd (Multi-threaded debug)
I'm running the project with debug mode.
You already got libboost_thread-vc100-mt-gd-1_49.lib so enable your project to use dynamic linking in "configuration properties".
Another option is to download Boost and build it using static linking to generate the libboost_thread-vc100-mt-sgd-1_49.lib file. Don't forget to set the folder of "Linker" -> "Additional Library directories" to the location of the file.
I am receiving the LNK 2019 error in VS2010 while trying to build the project.I have included the header files from other project using external dependencies.Each time at build time the LNK 2019 rises for the function defined in those header files.Any idea how to fix it?
This error is caused by the linker which cannot find call address of an external function. So it "doesn't know" where is located the implementation of the function declared in your external header file.
To fix this apart from specifying external header files you should also specify the paths to the binary files (".dll" in your case) built from your external project sources. In order to do this use context menu of your project in Visual Studio - {Properties -> Configuration Properties -> Linker -> General}, then add to the "Additional Library Directories" field paths to the directory where your extenal libraries located. After that use {Properties -> Configuration Properties -> Linker -> Input} and add to the "Additional Dependencies" field names of your external libraries ".lib" files.
This should help.
I have a visual C++ project for a DLL and a setup project for it. In the installer i've added the content files of my project.
Is there a way to add a file as a content file depending on if you are compiling debug or release? I want to include boost_date_time-vc100-mt-gd-1_51.dll if I compile under debug and boost_date_time-vc100-mt-1_51.dll if I compile under release.
My additional deps looks like this
Shell32.lib;libzmq.lib;log4cxx.lib;boost_date_time-vc100-mt-gd-1_51.lib;...
Under additional library directories i've added the path to all these .lib files which also contains their respective .dll files
I've tried the following with no success...
Added a Custom build step to run before build that copies the correct dll files to the OutDir and set the Output of this custom build step to be the dll files.
Conditionally include a content file by manually editing the vcxproj file. If configuration was release mode I would set the non-debug version as deployment content and the debug version to false and vice versa for Debug mode. This looked something like this,
<ItemGroup Condition="'$(Configuration)'=='Release'">
<None Include="boost_date_time-vc100-mt-1_51.dll ">
<DeploymentContent>true</DeploymentContent>....
</None></ItemGroup
Neither of these worked however. The second option seemed to always default to debug mode no matter how I built my project.
When you add a dependency, you can add it to one configuration or all configurations:
[This picture is of VS 2012, but 2010 and 2008 look pretty much the same.]
So, you pick the configuration you want to modify at the top-left, then add the library to the additional dependencies. Note that what you add here will be the .lib file associated with a DLL, not the dll itself (the compiler will make the executable depend on the DLL because you link with its .lib file).
I installed Visual Studio 2010, Qt and Cmake. I configured them. Then I wanted to test by an example code. However, the program cannot find the header files. I searched on the internet and found that there might be a problem with the PATH.
Then, I followed this way that results in failure:
I wrote each folder name separately by putting semicolon between them to
Project > Properties > C/C++ > General > Additional Include Directories.
In this way, program found the header files but it gave me an error LNK1104. I think it happened because the Path for file name expands to more than 260 characters. I learned that from this site.
I tried to find one folder that I can write to PATH. I think it's lib file. But I could not find it.
what should I do to fix this problem?
Setting two values in visual studio will remove this error.
Go to Properties of the project -> C/C++ -> All Options -> Set the correct value for "Additional Options".
Go to Properties of the project -> Linker -> Input -> Set correct the value for "Additional Dependencies".
If you create the project using CMake, then these values will be setup automatically.