Solved

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

Posted on 2002-03-19
5
195 Views
Last Modified: 2010-05-18
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?
0
Comment
Question by:rangers99
5 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
ID: 6881987
1). File->New->Project
2). MFC AppWizard (exe)
     Type the project name, and specify correct location
     Press OK
3). Select Dialog Based and press Finish and OK
     The wizard will create the necessary files for the project
4). Project->Add To Project->Files...
     Select the header and the c file for adding files to project
5). Place a Button on the Dialog, and use using ur .c file u can compress
     Use #include "YourHeaderfile.h" in stdafx.h

Press F5 for compilation

GOOD LUCK
0
 

Expert Comment

by:guysmartgal
ID: 6882019
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
0
 

Author Comment

by:rangers99
ID: 6882346
thanks mate.
0
 
LVL 2

Expert Comment

by:jonnin
ID: 6882355
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).


0
 
LVL 86

Expert Comment

by:jkr
ID: 6883091
HUH???

You'd do that on the command line:

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now