admin管理员组文章数量:1335624
I've been trying to setup libjpeg for a project I'm working on, but after installing it I can't seem to get it to work.
I installed libjpeg-turbo from the github repo and installed cmake etc as it says in the building.md file and built it all. I have this all stored in its own directory
I then have some code for my project, nothing substantial yet but I just want to be able to turn a JPEG image into its raw pixel data which I followed a tutorial for, however when I'm trying to compile my code its not recognizing any of the functions defined in libjpeg
My file structure is Project -> Libraries, Code Libraries -> where I downloaded and built libjpeg-turbo Code -> several c files for my project
My c files are Image.c, ImageConversions.c, main.c
Image.c is just a class for storing data about an image Image conversions is the bulk of the code, it has
#include <stdio.h>
#include <stdlib.h>
#include <jpeglib.h>
#include <jerror.c>
#include "Image.c"
then main.c just tries to pass the argument given in the cmd when its run to my function for turning the JPEG to pixel data in ImageConversions.c
it also has #include "ImageConversions.c"
of course
the problem arises when I try to compile main.c, it doesn't recognize any of the libjpeg functions as defined in ImageConversions.c, e.g
Temp\ccy8qOzo.o:main.c:(.text+0x7c): undefined reference to `jpeg_CreateDecompress'
there is one of these for each time I reference a function from libjpeg
the command I'm running when I compile is gcc main.c -I "Path to Libraries folder" -I "Path to src folder within libjpeg-turbo"
These are the two directories which contain the libraries (one is within the other). I have also tried with -L
flags instead, I've tried directly placing the .h files into the /MinGW/include folder and tried gcc main.c
and the same happens
I have also tried the latter with the -ljpeg
flag which I saw as a potential fix online but I got a error as -ljpeg
was unrecognized. I feel this may be a clue to the problem but I'm not entirely sure
I tried to find a .a library file but I couldn't find one in libjpeg-turbo
This is my first time trying to install an external library and use it in c so I may have messed several things up with the installation or putting files in the wrong place, I tried to find a clear guide for this but couldn't find one
I'm using VScode if that makes any differences
I summarized the steps I took for installing it all at the start and if any other information is needed please ask
any help would be appreciated, Thankyou!
本文标签: cErrors with linking with libjpegturboStack Overflow
版权声明:本文标题:c - Errors with linking with libjpeg-turbo - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742313921a2451429.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论