I am using the boost for my application when I tried building using VIsual studio 9.0 i get
1>LINK : fatal error LNK1104: cannot open file 'libtorrent.lib'
how to make the libtorrent.lib . I am having trouble in this ....if any one is having any solution please help me.
The .lib is not included in your project. Make sure you are linking it in; Configuration Properties -> Linker -> Input -> Additional Dependencies
Another altnerative is to simply copy the .lib to your project folder but don't, it's bound to create problems later on.
Sometimes the .lib is not shipped with the library, so you need to compile it yourself. The README will tell you this. If this is the case, they usually ship with a .sln file you can open and the just compile it into a .lib file which you then reference in your main application, as I wrote above
Related
I'm trying to install Assimp to use in my projects, but I'm having some trouble. I'm currently using win 10 pro and visual studio 15 2017.
I have downloaded Assimp 4.0.1.zip, extracted it into a directory, loaded cmakeGui and ran configuration twice, then generated into Assimp/build directory.
Next I went into Assimp/build and I ran the Assimp.sln and chose the ALL_BUILD I think it was. I then copied all the files in the /code/debug that were alongside the .lib and .dll and moved them all into the Debug directory of my project where my exe is built to. I copied the .lib into my opengl/libs directory and all the headers in /include from the originally extracted download into my opengl/includes/assimp directory.
Finally, I adjusted my projects linker settings to include the assimp.lib and assimp.dll (alias for simplicity of this post)
When I tried to build the project it said it could not open the dll and when experimenting I copied the dll into the project dir alongside main.cpp and my other files and ran again, it this time said "invalid or corrupt file: cannot read at 0x378"
It's safe to say I need to study up on compiling, linking and cmake but for now I started over.
I thought I had it working(and maybe I do...) after I got it to stop complaining when I was including the headers into my project. To do so I started from fresh, built Assimp same as before, moved all the files with the dll into my libs directory, dumped all the includes from the download into my includes, also move the config.h from the build into this directory. Then I set the linker settings in the project and didn't move anything into my project directories.
After that, it stopped complaining so I proceeded with the tutorial series I was following. I compiled, got a load of errors, fixed them down to 0 then suddenly I got 8 new ones in their place.
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _aiGetMaterialTextureCount referenced in function "public: unsigned int __thiscall aiMaterial::GetTextureCount(enum aiTextureType)const " (?GetTextureCount#aiMaterial##QBEIW4aiTextureType###Z) opengl_model_loading F:\Desktop\MyDocuments\Tuts\opengl\getting started\opengl_model_loading\opengl_model_loading\main.obj 1
This error gave me the feeling it was probably due to the dll.
Please advise.
I've just recently done this myself & will say had lot of trouble with v401 & getting errors or linking issues. Successfully got mine working with following;
Note: ASSIMP does have boost as a dependency.
Download/clone master Asset-Importer-Lib from github:
https://github.com/assimp/assimp
Open Cmake GUI & once open:
Where is the Source code: "..\MyDocuments\assimp\assimp-master"
Where to build the binaries: "..\MyDocuments\assimp\assimp-master\build". You will need to make a build folder & point Cmake to it.
2.1. Alternatively if you're familiar with command line option: generate project files with relevant paths using
cmake -G”Visual Studio 14 Win64"
Click configure.
Then Generate. Make sure you select correct build option ie VS15 2017 64bit.
Load "..\MyDocuments\assimp\assimp-master\build\Assimp.sln" with Visual studio.
Right click "ALL_BUILD" & select "Build". This will take several minutes. Once done & no errors, it should create necessary *.dll/*.lib in
..\MyDocuments\assimp\assimp-master\build\code\Debug
Link & include into your existing project the relevant *.lib & also
"..\MyDocuments\assimp\assimp-master\include\assimp" folder. You will also need to make sure *.dll file is in the same folder, or included, as the *exe you're running.
You may also need to copy over from the ..\MyDocuments\assimp\assimp-master\build\include\assimp\config.h" & include it in step7.
Just ensure you're building right libraries for your code ie 32/64bit/debug/release/unicode/etc, otherwise may encounter issues still.
Following video is useful for the visually inclined.
https://youtu.be/W_Ey_YPUjMk
Hope this helps.
EDIT:
If you want static library version ie no .dll required:
From above steps:
5.1. Change relevant project configuration type & extension from .dll to .lib type (should be two: assimp & zlib).
5.2. Right click "UpdateAssimpLibsDebugSymbolsAndDLLs" ->Properties->Build Events & update the paths in the command line sections from ..\Path*.dll to ..\Path*.lib. (If encounter errors, do same on assimp_cmd project).
Same as above but now also need to link your project to IrrXML.lib & zlibd.lib. Should no longer need the *.dll file.
Somehow, even after going through a lot of materials, I could not understand one thing. I have a c++ library project in Visual Studio 2013. When I build it, it creates *.lib file. Now, there is another project where I need to link the .lib file. I created a folder called lib, dumped the .lib file in there and set the path of the lib folder to Properties->Linker->General->Additional Library Directories. Next I added the library file name *.lib in Properties->Linker->Input->Additional Dependencies. Now, building the project throws huge list of linker errors with message unresolved external symbol .... What is that I need to do more for linking the library?
I'm not sure what's the language your "another project" used, anyway, you should specifically set your *.lib file in Linker->Input->Additional Dependencies if you didn't explicitly load it in code.
If the both projects reside in the same solution the simplest option is to right-click of the project, go to to Properties, there go to Common Properties and in Framework and References add a reference to that library project. This will set the linker to link the .lib and adds a build dependency so the lib is always compiled before the executable.
I am using boost generic image library and it requires libpng. I built libpng and obtained the files libpng.lib, zlib.lib and libpngd.lib. When I tried to compile my project, Visual Studio gives a fatal error
fatal error LNK1120: 21 unresolved externals
with a bunch of unresolved external symbols like _png_set_sig_bytes and _png_read_row. What's going on here and how to solve it?
From MSDN:
https://msdn.microsoft.com/en-us/library/ba1z7822.aspx?f=255&MSPPError=-2147217396
To add .lib files as linker input in the development environment
Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
Click the Linker folder.
Click the Input property page.
Modify the Additional Dependencies property.
You must do this; explicitly specifying "libpng.lib", "zlib.lib" and "libpngd.lib" in your .exe's link command.
So this is coming from a complete simple minded moron so maybe this'll be helpful....it took me a little while to grasp. Basically, you're downloading the source code. That means, that you have to be the one to compile the source code.
Windows can compile programs that are written in C in the command prompt. You have to build the program, and it spits out a .dll or a .lib file. That or those are the files that you link to visual studio application.
You set dependencies to the header files which is usually like the source codes root folder or wherever all those .h files are.
You then set the linker to link to the .dll or .lib file(s). In Boost C++'s case, you need to link to a 'lib' folder.
I think what you need is to go over and completely grasp the basics. Here's a link from Microsoft on how Windows can compile C programs from the command prompt:
https://learn.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=vs-2019
So I imported this VS9 solution into VS10 and VS10 would convert the whole thing into its new format for solution and project files. However, now it is giving me linker errors.
One project, a native C++ project, is using a set of header files and a .lib file to link to some external library. In the project, this library is specified by being put into a "Library" folder in the project. In VS9, this works fine, in VS10, it fails. The same lib is linked, however, when put into the "Additional Dependencies" setting in the Linker Input panel of the project's options.
I know the technique to drop lib files into the project for more than a decade. Has this stopped working with VS10?
No ,that still works in VS2010 (just tested it to make sure)!
I am writing a basic toon shader in OpenGL. I am using MSVC 2008. I have included the GLEW libraries. I have also set the additional dependencies in linker. But I am getting the following error:
LINK : fatal error LNK1104: cannot open file 'glew32.lib'
You need to set your linker to look in the correct place for the library. Either you don't have the lib, or your linker can't find it. Open your project properties dialog, go to linker, specify the lib as a dependency and provide the path to the correct lib folder.
you can also drag and drop the glew32.lib (or any other lib file of course) into your visual studio project and i think it will be automagically linked in and the linker will find it (which i think is your problem).
anyhow, i prefer setting my search directories by hand.
add this:
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
It will definitely solve your problem.