954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Missing Library in Compiling

When I try to compile

g++-4.2 memJpegDecoder.cpp

I get these errors.

/usr/lib/gcc/x86_64-linux-gnu/4.2.1/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/cci2IOXX.o: In function `memJpegDecoder::decompress()':
memJpegDecoder.cpp:(.text+0x5b5): undefined reference to `jpeg_calc_output_dimensions'
memJpegDecoder.cpp:(.text+0x68a): undefined reference to `jpeg_start_decompress'
memJpegDecoder.cpp:(.text+0x6ac): undefined reference to `jpeg_read_scanlines'
memJpegDecoder.cpp:(.text+0x730): undefined reference to `jpeg_finish_decompress'
memJpegDecoder.cpp:(.text+0x739): undefined reference to `jpeg_destroy_decompress'
/tmp/cci2IOXX.o: In function `memJpegDecoder::readHeader()':
memJpegDecoder.cpp:(.text+0x756): undefined reference to `jpeg_read_header'
/tmp/cci2IOXX.o: In function `memJpegDecoder::setSource(char*, long)':
memJpegDecoder.cpp:(.text+0x79a): undefined reference to `jpeg_std_error'
memJpegDecoder.cpp:(.text+0x7b7): undefined reference to `jpeg_CreateDecompress'
memJpegDecoder.cpp:(.text+0x7c8): undefined reference to `jpeg_mem_src'
collect2: ld returned 1 exit status


I've tried linking the libjpeg files in /usr/lib, but it doesn't seem to be working. The header file that makes these calls can be found at https://setisvn.ssl.berkeley.edu/svn/seti_boinc/jpeglib/jpeglib.h . Please let me know if you have any questions.

nesalang
Newbie Poster
1 post since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

>>g++-4.2 memJpegDecoder.cpp
That is attempting to compile the *.cpp and create the executable program a.out. From the error message I assume that *.cpp file doesnot contain a main() function, which is required of all c and c++ executable programs.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

I'm working on a different part of the same project with him. Hopefully I'll get a copy of his work within a day or two, but the main thing we're trying to do right now that's giving those errors is that the project builds correctly with cmake. We're trying to write our own make file for the entire project, so we're trying to get it to work with make instead of cmake. I'll be back when I get his part.

hazmatt
Newbie Poster
10 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You