Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel/Word Add-in in what language? 5 128
is twain_32.dll cmpatible with windows 10 ? 10 184
How to properly read C++ console input into several variables with scanf 2 20
Outlook 13 41
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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…
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…
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.

856 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