views:

1015

answers:

5

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

+1  A: 

is it a C/C++ console application? did you use the project wizard to create it?

do you have a function like

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    printf("Hello, world!\n");
    return 0;
}

in a .c module, typically main.c?

what happens when you hit F5 to run-with-debug? what does your build log look like?

Steven A. Lowe
+1  A: 

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, choose Add > New Item. Then add a main.cpp, rename it to main.c, and start coding.

amdfan
Does "Empty Project" have an entry point and linker settings that will output a .Exe?
Aidan Ryan
Either it does or it generates them, because I'm getting an .exe every time.
amdfan
+4  A: 

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.

A: 

http://msdn.microsoft.com/en-us/library/ms235299.aspx

Note:

It is not supported to redistribute C/C++ applications that are built without a manifest. Visual C++ libraries cannot be used by C/C++ applications without a manifest binding the application to these libraries. For more information, see Choosing a Deployment Method.

If the DLL is not reachable and Windows cannot load this DLL for your application, you may get the following error message:

This application has failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem.

To resolve these errors, you must make sure that your application is built correctly and Visual C++ libraries are correctly deployed on the target system. To identify the root cause of these run-time errors, follow the steps outlined in Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies.

HTH

plan9assembler
A: 

Sounds like you only hit compile, that will give you you're .obj file, but you still need to click build.

John T