I'm just starting out writing trying to write a simple program in C and I am using Visual Studios to do so. I heard that it does compile C as well as C++. And I know that it does because it says it compiles. The only problem is that when I go to the output directory, there isn't a .exe file in the directory! It has the following:
- BuildLog.html
- mt.dep
- test1.obj
- vc90.idb
- vc90.pdb
But that is all! No EXE. I've looked through all the options and made sure that it is set to compile to an exe and i checked the output file. That is $(OutDir)\$(ProjectName).exe. But alas, no exe appears. Any ideas?
Also when i try to hit f5 and run with debut i get an error that says
This application has failed to start because MSVCR90.DLL was not found. Re-installing the application may fix this problem
The simplest thing to do is just start over, making sure you choose the right kind of project.
To compile plain old C code with Visual Studio, choose
Visual C++ > General > Empty Project
from the New Project menu. This creates 3 empty folders: Header Files, Resource Files, and Source Files. Right click on Source Files, chooseAdd > New Item
. Then add amain.cpp
, rename it tomain.c
, and start coding.is it a C/C++ console application? did you use the project wizard to create it?
do you have a function like
in a .c module, typically main.c?
what happens when you hit F5 to run-with-debug? what does your build log look like?
By default when you're creating a new C++ project within a new solution, you're getting folder structure like this:
C:\Projects\YourSolution C:\Projects\YourSolution\YourCppProject
YourSolution contains YourSolution.sln and YourCppProject contains YourCppProject.vcproj.
When you build the solution, all intermediate files from YourCppProject are getting stored under YourCppProject\Debug or YourCppProject\Release, but resulting YourCppProject.exe goes under YourSolution\Debug or YourSolution\Release.
Your $(OutDir) is configured by General -> Output Directory. Check project configuration for YourCppProject and see that it uses $(SolutionDir) for the output.
Sounds like you only hit compile, that will give you you're .obj file, but you still need to click build.
http://msdn.microsoft.com/en-us/library/ms235299.aspx
HTH