Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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. …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

738 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