Link to home
Start Free TrialLog in
Avatar of rangers99
rangers99

asked on

Compiling C source code that includes a main() function using Visual C++

OK I am asking this question because Im thick.

I have a C source code (compress.c file) and a header (*.h) file. The compress.c file has a main() function so its not a Windows application. Its actually a compression algorithm source code. I will probably run it by going to the command line and typing

compress pic.gif

Or something similar. So how do I create the compress.exe using Visual C++? I assume I go to File->New->Project or something like that but I really dont know.

Can someone familiar with the required steps help me out?
ASKER CERTIFIED SOLUTION
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of guysmartgal
guysmartgal

go to
File->New->Win32 Console App
and then continue saying finish after giving filename.
Press Alt+F7 select, "no MFC Support"
Compile and Execute normally
Avatar of rangers99

ASKER

thanks mate.
Minimal steps:
open the main file in studio,
press f7 to build. yes, let it do workspace for you.
done. you may want to tweak the options, they default to debug and stuff... (no mfc will also be a default, it detects this in the build and its off if no win stuff is found).


Avatar of jkr
HUH???

You'd do that on the command line:

cl.exe compress.c -I "<path to your .h-file>"