Solved

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

Posted on 2002-03-19
5
192 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

747 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

15 Experts available now in Live!

Get 1:1 Help Now