I downloaded jpeglib-9a. In Visual studio (2012) command prompt I typed this:
nmake /f makefile.vc setup-v10
It created several files and one of them was named "jpeg.sln" which I opened in visual studio (updated to 2012 version) and built. After that, I made new project, included this folder "D:\Data\jpeg-9a" and added this folder "D:\Data\jpeg-9a\Release" to linker.
And when I tried to compile my project, this error appeared:
1>LINK : fatal error LNK1181: cannot open input file 'D:\Data\jpeg-9a\Release.obj'
I was looking for that file but couldn't find it anywhere. I also tried compile that library again but "Release.obj" is still missing.
This is the tutorial which I was following
http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html
So is there any way how to create that file ?
Thank you.
(if you need additional information, ask me)
SOLVED: ... I cant read properly ...
Thank you bogdan
You don't need to create that file.
The linker is interpreting the D:\Data\jpeg-9a\Release directory name as an input .obj file name. Most likely, this is happening because you added the directory name in the wrong place in the linker configuration property pages. My guess is that you added it under Linker -> Input -> Additional Dependencies; that's not the right place for a directory - that property is supposed to contain a list of .obj and .lib files to be given as input to the linker.
You need to add the directory under Linker -> General -> Additional Library Directories.
Related
I really did not want to post on something possibly asked a zillion times, but this is very desperate.
I have a solution named HexEx containing 6 projects. 3 of them do not build due to not finding this lib.
The process I follow:
step 1) Configuration properties>general>configuration type set to .exe
step 2) VC++ directories: Added the path where the .lib is (doubled checked the path is correct through the cmd and checked the name is correct (indeed the name is OpenVolumeMesh.lib although the .lib does not appear in windows)).
I added the path in executable directories and library directories.
step 2.5) VC++ directories: Added also include path used to create the OpenVolumeMesh.lib
step 3) In linker >general I added the same path to >Additional Library Directories.
step 4) In linker, once more in >Input I added the library (OpenVolumeMesh.lib) to Additional dependencies.
The error I get is:
3>LINK : fatal error LNK1104: cannot open file 'OpenVolumeMesh.lib'
in 3 out of the 6 projects, I suppose the ones needing it.
Another attempt I tried (and this is probably stupid) was to add #pragma comment(lib,"OpenVolumeMesh.lib") in every .c or c++ file containing code.
The .lib was created by building a previous project of mine. All of this is done in VS 12 2013 x64.
From what I read there must also be some .dll put in windows system32 folder some times? Might this be the problem?
Any suggestions?
I'm trying to follow this tutorial to get SDL working. I've followed the steps he outlined:
In my properties under VC++ Directories I have:
Include Directories
C:\SDL2-2.0.4\include;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt;
$(IncludePath)
Library Directories
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt;
C:\SDL2-2.0.4\lib;
$(LibraryPath)
Under Linker > General I have:
Additional Library Directories
%(AdditionalLibraryDirectories)
I also have SDL2.dll placed in E:\Dev\cpp\SDL Setup\MyProject\Debug
When I have it like this I get the error Cannot open file 'SDL2.lib' but if I set the directory to the SDL lib (I.E. C:\SDL2-2.0.4\lib\x64) it no longer displays the error but then shows the error Cannot open file 'uctrtd.lib'.
I'm not sure if that error is a step in the right direction. Any help would be greatly appreciated.
From your post, it is evident that LIB files are present at:
C:\SDL2-2.0.4\lib\x64;
and not at:
C:\SDL2-2.0.4\lib;
So, you must use the x64 path to get the lib. It is also visible that .LIB for 64-bit are present in x64 folder, and there must be something for 32-bit linking (in C:\SDL2-2.0.4\lib itself) - for you 32-bit build.
Please fix it gradually, calmly and in step-by-step manner.
The error you are later getting for uctrtd.lib is probably because you messed up standard LIB paths. Bring the original LIB paths back, and append this library's LIB path.
I'm working in a Cocos2dx (c++) win 32 project and trying to use sqlite to save the game data. My knowledge of c++ / Visual Studio is very limited right now.
This is part of the code that I'm trying to compile.
#include <sqlite3\include\sqlite3.h>
...
void HelloWorld::SaveAndLoadTest()
{
sqlite3 *pdb = NULL;
sqlite3_open("writablePath", &pdb);
...
}
But when I try to compile the line with the sqlite3_open command I get the following error:
Error 7 error LNK2019: unresolved external symbol _sqlite3_open referenced in function...
I've been trying to find an answer for this many hours. The most similar question I found was this one but I don't understand the answer.
Error: undefined reference to `sqlite3_open'
You need to link the sqlite3 library along with your program:
g++ main.cpp -lsqlite3
I'm new to Visual Studio and I don't understand how to solve this, anyone?
The error LNK2019 means that references are missing probably because a library is mising.
To add sqlite to a MSVC project, you have to make sure that:
the header is included in your source files
sqlite3.dll is in the path or in the directory of the executable
AND that sqlite3.lib is added to the additional dependencies in the VS project (options of the project > Linker > Input > Additional dependencies)
This last point is mandatory, because the lib tells the linker which functions are stored in the dll.
The solution, quite simply, is to link sqlite3 to your project. Libraries need to be linked (via the linker) for you to be able to use them. Head over here and download the pre-compiled binaries for your platform of choice (in this case, Win32). You may also choose to compile sqlite3 from source. You should end up with a .lib file. Go to Project -> Configuration Properties -> Linker -> General -> Additional Include Directories and add the path to your library file to it. Then go to Linker -> Input -> Additional Dependencies and put in sqlite3.lib.
And remember that you must build sqlite3.lib from file SQLite3.def:
Download source from source (https://www.sqlite.org/download.html)
For example: source https://www.sqlite.org/2022/sqlite-amalgamation-3390300.zip
Or download binary from binary
For example: binary https://www.sqlite.org/2022/sqlite-dll-win64-x64-3390300.zip
Extract both archives to the same directory
Open Developer Command Prompt for VS 2017 by typing Developer Command in Windows Search
Go to directory where you've extracted source code and binary files (via opened cmd)
Run lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64
(Remember if win32, replace "MACHINE:x64" by MACHINE:x86)
I'm new C++, I have a dll file called DiceInvaders.dll, in my project, I need to use this library, I'm using visual c++ 2010, I set the Linker Input as DiceInvaders.lib and DiceInvaders.dll, I also copied this dll file to my porject directory, I always got error in this line of code:
m_lib = LoadLibrary("DiceInvaders.dll");
assert(m_lib);
The error is assertion failure. How should I solve this? Thank you in advance.
First you cannot pass the DLL to the linker like you are, it is not a file type that the linker recognizes and cannot be linked that way. When you create the Diceinvaters.dll file the linker will create an import library with the same filename and the extension .lib. It appears this is already being done. That is the library file you should pass to the linker when building any application that uses it.
Second, the Diceinvaders.dll file must be accessible in the DLL search path. This varies slightly depending on which version of Windows you are using but is generally something like the following
The directory the program was loaded from.
The current working directory.
The System directory.
The Windows directory.
The directories that are listed in the PATH environment variable.
Placing the DLL in your project directory is not going to be enough. Instead you should place it in the same directory as the EXE file(s) that have a dependency on it.
I got a library here which uses the Intel Composer XE 2013 and I would like to compile it as a .lib as I am going to use it with another project (It is compiling as application/EXE by default). However, when I set the Configuration Type under Project Defaults under the Configuration Manager in Visual Studio 2012, I get " error LNK1181: cannot open input file" Odd part is that the file it looks for has no file ending. The project contains both C, C++ and ASM code. Does anyone got any experience with this kind of behavior?
Some common causes for error LNK1181 are:
filename is referenced as an additional dependency on the linker
line, but the file does not exist.
A /LIBPATH statement that specifies the directory containing filename
is missing.
To resolve the above issues, ensure any files referenced on the linker line are present on the system.
Use the /LIBPATH option to override the environment library path. The linker will first search in the path specified by this option, and then search in the path specified in the LIB environment variable. You can specify only one directory for each /LIBPATH option you enter. If you want to specify more than one directory, you must specify multiple /LIBPATH options. The linker will then search the specified directories in order.
To set this linker option in the Visual Studio development environment
Open the project's Property Pages dialog box.
Click the Linker folder.
Click the General property page.
Modify the Additional Library Directories property.
If that doesn't help then you can look through these links :
Getting fatal error LNK1181: cannot open input file
You receive a "fatal error LNK1181" error message when you build a
Managed C++ application
Visual Studio: LINK : fatal error LNK1181: cannot open input
file
I solved the issue by renaming the .obj files without their file extension. For example, it was looking for file name "foo", I had "foo.obj" so I renamed "foo.obj" to "foo".