?
Solved

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

Posted on 2002-03-19
5
Medium Priority
?
200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 800 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

764 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