jpeglib static library creation problem

I have to create static library for jpeglib software (based on Linux).
The static library should be created for msvc 2017, windows 10.
The procedure I have followed is given:

http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html
and
https://stackoverflow.com/questions/12652178/compiling-libjpeg

I have created jpeg.lib. dumpbin reads its functions. I have place it in right place for linking. However, build stops because of error:

Error LNK2019 unresolved external symbol jpeg_std_error referenced in function
"int __cdecl decode_JPEG_data(unsigned char *,int,int &,int &,unsigned char *,int &,bool)"....
Error LNK2019 unresolved external symbol jpeg_CreateDecompress referenced in function
"int __cdecl decode_JPEG_data(unsigned char *,int,int &,int &,unsigned char *,int &,bool)" ....
In Miprograms for Viusal studio I have installed windows 10 SDK (10.0.4393.0).



I do not know what could be the problem? These are instruction I followed:

"Download the file WIN32.MAK (for example, from http://www.bvbcode.com/code/f2kivdrh-395674-down), and place a copy in the root source code directory (possibly C:\jpeg-9, but it depends where you unzipped it). I will refer to this directory as %jpegsrc% from now on. Having this file is important; otherwise step 3 will produce an error." I suspect that this file might the problem. What should I do?
Last edited on
Did you add jpeg.lib as an additional dependency to the project? It's not enough to put the .lib somewhere where the compiler can find it. You also need to tell the compiler to actually use that file.
Yes, I did it but problem might be that target which was created on my x64 computer is not recognised as such. I have on confirmation manager win32 only as an option for solution platform.

But in the very beginning I have a problem with:
From: https://stackoverflow.com/questions/12652178/compiling-libjpeg

"VS 2017 Approach:
Include the Windows SDK v7.1A directory (required for Win32.Mak by nmake later on) by running: set INCLUDE=%INCLUDE%;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
Run nmake /f makefile.win setup-v15 (note the v15 for VS2017 here)"

I could not do it properly maybe because I could download only windows sdk 10.x.x.x onwards, and even there I cannot allocate include subdir... So I am still using win32.mak downloaded from as it is stated above "Download the file WIN32.MAK (for example, from http://www.bvbcode.com/code/f2kivdrh-395674-down)", and of course I am using nmake /f makefile.win setup-v10. That might be problem...

Last edited on
You know, I'm pretty sure if you just create your own static library project and dump most of the libjpeg sources in there, you'll end up producing a working library. I've done that in the past. libjpeg just runs some number crunching on whatever data you pass to it, it doesn't need a lot of system-specific support. You may need to massage the config.h file a bit, is all (if there is one).
Last edited on
No the problem is that they used:

"Download the file WIN32.MAK (for example, from http://www.bvbcode.com/code/f2kivdrh-395674-down), and place a copy in the root source code directory (possibly C:\jpeg-9, but it depends where you unzipped it). I will refer to this directory as %jpegsrc% from now on. Having this file is important; otherwise step 3 will produce an error.
In the Visual Studio command prompt, open to %jpegsrc%:
cd %jpegsrc%
At the same command prompt, execute the following:
NMAKE /f makefile.vc setup-v10"

That works fine with me, but I got problems at the
end
Ok someone said like:
"This works with VS2013 x64. I copied Win32.Mak from "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" Well if that is the case that might work for sure. BUT:
For 2017 I have options to have only from 10.X.X.X onwards ands there is no win32.mak to put there. I guess I have to use set-v15 for 2017. I guess that is options not available in all SDKs.

Maybe to download it from somewhere or to use like you suggested to create static lib in Microsoft and to include by foot files for cpp and h..?
Topic archived. No new replies allowed.