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.

Recommended Answers

All 2 Replies

>>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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.