Compile C/C++ source code

I need to compile source code written in C and C++. There is a Makefile that comes with it. I'm attaching it. Can anyone give me any suggestions on how to compile it to a setup.exe file? Do I have to use Microsoft Visual Studio? Can cygwin do it? Thanks! -Ming
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

That Makefile is a very general one.. It will compile every .cc file in the directory using the g++ compiler, link the object files to the SDL library and produce a binary file called "dgl"

It will never produce a setup.exe. Exactly what is it you are trying to compile?

mybluegrassAuthor Commented:
This is the source file I'm trying to compile:

The imageprinter itself is a virtual image printer software for windows. It has Installer version which contains a setup.exe file: But it's not working as I've expected so I need to make some changes to the source file and recompile the source. The software's website is
The environment has to be in windows.
Thanks a lot!
Opps.. Already had a Makefile in my temporary download folder and some home opened that instead..  Sorry.

Downloaded and checked it out.

There are some hardcoded includes in the makefile.
C:/MinGw32/lib/gcc/mingw32/3.4.2/include C:/MinGw32/include/c++/3.4.2/backward etc.

So you will need to download MinGw, Visual Studio is not needed.

Good Luck!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

mybluegrassAuthor Commented:
I think I know why you said "Good Luck!" at the end. I modified the Makefile and run mingw32-make. But the process is stuck with the following error message:

windres.exe -i imgport.rc --input-format=rc -o .obj/imgport.res -O coff
dllwrap.exe --output-def install/i386/libimgport.def --driver-name c++ --
install/i386/libimgport.a .obj/Monitor.o .obj/PortList.o .obj/png.o .obj/
r.o .obj/pnggccrd.o .obj/pngget.o .obj/pngmem.o .obj/pngpread.o .obj/pngr
obj/pngrio.o .obj/pngrtran.o .obj/pngrutil.o .obj/pngset.o .obj/pngtrans.
pngvcrd.o .obj/pngwio.o .obj/pngwrite.o .obj/pngwtran.o .obj/pngwutil.o .
er32.o .obj/compress.o .obj/crc32.o .obj/deflate.o .obj/gzio.o .obj/infba
bj/inffast.o .obj/inflate.o .obj/inftrees.o .obj/trees.o .obj/uncompr.o .
il.o .obj/p2png.o .obj/jcapimin.o .obj/jcapistd.o .obj/jccoefct.o .obj/jc
 .obj/jcdctmgr.o .obj/jchuff.o .obj/jcinit.o .obj/jcmainct.o .obj/jcmarke
j/jcmaster.o .obj/jcomapi.o .obj/jcparam.o .obj/jcphuff.o .obj/jcprepct.o
csample.o .obj/jdapimin.o .obj/jdapistd.o .obj/jdatadst.o .obj/jdatasrc.o
dcolor.o .obj/jddctmgr.o .obj/jdhuff.o .obj/jdmainct.o .obj/jdmarker.o .o
ster.o .obj/jdmerge.o .obj/jdphuff.o .obj/jdsample.o .obj/jdtrans.o .obj/
o .obj/jfdctflt.o .obj/jfdctfst.o .obj/jfdctint.o .obj/jidctflt.o .obj/ji
o .obj/jidctint.o .obj/jidctred.o .obj/jmemmgr.o .obj/jmemnobs.o .obj/jqu
.obj/jquant2.o .obj/jutils.o .obj/rpcl.o .obj/bmpf.o .obj/p2jpg.o .obj/jd
o .obj/jdinput.o .obj/jdpostct.o .obj/tif_aux.o .obj/tif_codec.o .obj/tif
o .obj/tif_compress.o .obj/tif_dir.o .obj/tif_dirinfo.o .obj/tif_dirread.
tif_dirwrite.o .obj/tif_dumpmode.o .obj/tif_error.o .obj/tif_extension.o
f_fax3.o .obj/tif_fax3sm.o .obj/tif_flush.o .obj/tif_getimage.o .obj/tif_
.obj/tif_luv.o .obj/tif_lzw.o .obj/tif_next.o .obj/tif_ojpeg.o .obj/tif_o
obj/tif_packbits.o .obj/tif_pixarlog.o .obj/tif_predict.o .obj/tif_print.
tif_read.o .obj/tif_strip.o .obj/tif_swab.o .obj/tif_thunder.o .obj/tif_t
obj/tif_warning.o .obj/tif_win32.o .obj/tif_write.o .obj/tif_zip.o .obj/t
e.o .obj/utils.o .obj/cdjpeg.o .obj/rdbmp.o .obj/tiffcp.o .obj/tiff2pdf.o
mgport.res -L"C:/MinGw/lib" --add-stdcall-alias -lkernel32 -luser32 -lgdi
nspool -lcomdlg32 -ladvapi32  -lole32 -loleaut32 -luuid -lwsock32    -o i
dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
.obj/p2jpg.o:p2jpg.cpp:(.text+0x98d): undefined reference to `jpeg_set_qu
peg_compress_struct*, int, unsigned char)'
.obj/p2jpg.o:p2jpg.cpp:(.text+0xa1e): undefined reference to `jpeg_start_
s(jpeg_compress_struct*, unsigned char)'
collect2: ld returned 1 exit status
dllwrap.exe: c++ exited with status 1
mingw32-make: *** [install/i386/imgport.dll] Error 1

Any thought?


Does the file "install/i386/libimgport.def" exsist in the program folder?

Looks like dllwrap.exe fails and uses a standard definition.

Might try to build it my self later today..
No, you are missing some library or object file, infacts make didn't find the function "jpeg_set_qu..peg_compress_struct" (I think the name is truncated).
I think that the missing library is libjpeg... Have you installed it?
mybluegrassAuthor Commented:
Thanks! The problem is that, I installed a higher version of MinGW (3.4.5). I should use 3.4.2. I uninstalled the 3.4.5 and installed 3.4.2 and everything works now. So, all .o files are in .object directory. But how can I make a setup.exe file out of those object files? Sorry that I haven't worked with C++ in this way.

Thanks a lot!

mybluegrassAuthor Commented:
I actually installed NSIS and used the setup.nsi file included in the install directory. But when I drag the file into the NSIS window, the file failed on line 58 because it cannot find File: "i386\Options.exe". I'm attaching the setup.nsi file. I have to change the extension because the .nsi extension is not allowed to upload.

Thanks a lot!

mybluegrassAuthor Commented:
The problem is that the Options.exe is generated by another package. I have to copy it over to the install folder so the setup.nsi file is able to run.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.