this is a follow up to my previous question I asked, I made some progress with things but hit another roadblock.
I downloaded the libjpeg-turbo library from the main github repo, then I built it using MSYS2 and then ran make and make install.
This gave me the libjpeg-turbo-gcc64 folder which has the include folder and lib folder the include folder contains jpeglib.h, jconfig.h, jerror.h, jmorecfg.h and turbojpeg.h
the lib folder contains libjpeg.a, libjpeg.dll.a, libturbojpeg.a and libturbojpeg.dll.a
But with this I am unable to get my code to compile with the library.
my file structure is same as last time, I have:
main.c
ImageConversions.h
Image.h
main.c has
#include "ImageConversions.h"
ImageConversions.h has
#include "Image.h"
#include <stdlib.h>
#include <jpeglib.h
#include <jerror.h>
Image.h has
#include <stdio.h>
ImageConversions.h is where the problem comes up
I am on windows by the way and have tried using VS for building libjpegturbo as well but this wasn't working
I have tried moving the .h files into the MinGW include folder and the libjpeg.a library and others into the MinGW lib folder (I have MinGW isntalled for gcc using the msys-base package and mingw32-base package although I don't think I need both)
I then tried running
gcc main.c
gcc main.c -ljpeg
gcc main.c -I"C:\MinGW\include" -L"C:\MinGW\lib" -ljpeg
gcc main.c -I"C:\libjpeg-turbo-gcc64\include" -L"C:\libjpeg-turbo-gcc64\lib" -ljpeg
gcc -I"C:\MinGW\include" -L"C:\MinGW\lib" main.c -ljpeg
and some others I have probably forgotten, as well as putting the .h files in the same folder as my main.c file and changing the <> to "" in the include statement for them so it can look in the same directory but all of these result in undefined reference errors throughout the Image conversions header file when it gets to that point in compilation.
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x58): undefined reference to `jpeg_std_error'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x7c): undefined reference to `jpeg_CreateDecompress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x91): undefined reference to `jpeg_stdio_src'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0xa7): undefined reference to `jpeg_read_header'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0xb5): undefined reference to `jpeg_start_decompress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x19f): undefined reference to `jpeg_read_scanlines'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x1bd): undefined reference to `jpeg_finish_decompress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x1cb): undefined reference to `jpeg_destroy_decompress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x201): undefined reference to `jpeg_std_error'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x225): undefined reference to `jpeg_CreateCompress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x281): undefined reference to `jpeg_stdio_dest'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x2be): undefined reference to `jpeg_set_defaults'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x2db): undefined reference to `jpeg_set_quality'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x30a): undefined reference to `jpeg_start_compress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x5e2): undefined reference to `jpeg12_write_scanlines'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x62e): undefined reference to `jpeg_write_scanlines'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x64c): undefined reference to `jpeg_finish_compress'
C:\Users\jackw\AppData\Local\Temp\ccAg4PWj.o:main.c:(.text+0x665): undefined reference to `jpeg_destroy_compress'
the image.h file is just a class definition for storing the pixel rgb values in a jpeg image
ImageConversions.h contains two functions, one for turning an image file to the rgb values and another function for the converse, it is very heavily based off of the example.c file in the libjpeg-turbo documentation example.c
but I just get the undefined reference errors
I am fairly new to c so could be a dumb mistake on my end somewhere or improper practice but for some reason the compiler doesn't seem to be linking properly? any ideas?