I have been trying real hard to get libJPEG 9b to work on my Visual Studio Community 2017 project. I have tried a few methods:
- Using NMake from Visual studio Command Prompt which gave me jpeg.sln and apps.sln, I built those and got cjpeg.exe and djpeg.exe which seem to be working. I have no idea how to link that library even now to my current project and make it work like a normal library!
- I followed the MinGW instructions on this answer, which gave me .a, .la and .dll.a files. After this I added the include and lib directory paths in my project properties and the .a library file in the linker properties. I also copy-pasted the .h files in my project directory.
I am trying out the code given here. Now, I seem to be getting a bunch of linking errors.
1>------ Build started: Project: JpegReadWrite, Configuration: Debug x64 ---
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_std_error referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_CreateDecompress referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_destroy_decompress referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_mem_src referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_read_header referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_start_decompress referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_read_scanlines referenced in function main
1>JpegReadWrite.obj : error LNK2019: unresolved external symbol jpeg_finish_decompress referenced in function main
1>D:\tonbo_stuti\libjpeg\jpeg-build\lib\libjpeg.a : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Users\tonbo\Documents\Visual Studio 2017\Projects\serverAppl\x64\Debug\JpegReadWrite.exe : fatal error LNK1120: 8 unresolved externals 1>Done building project "JpegReadWrite.vcxproj" -- FAILED.
I am thoroughly confused on how to make libJPEG work and don't understand what's going on as I am new to the Visual Studio environment. I checked that these symbols actually are defined in "jpeglib.h" and I have included that. I thought I can do the same steps for a .a file as for a .lib file, but something is going wrong.
I would really appreciate any help.