• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 900
  • Last Modified:

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
  • 5
  • 3
1 Solution
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: http://code-industry.net/public/ImagePrinter_2.0.1.src.zip

The imageprinter itself is a virtual image printer software for windows. It has Installer version which contains a setup.exe file: http://code-industry.net/public/ImagePrinter_2.0.1.zip. 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 http://code-industry.net/downloads.php.
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 http://code-industry.net/public/ImagePrinter_2.0.1.src.zip 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 http://www.mingw.org/, Visual Studio is not needed.

Good Luck!
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now