element

first should say am not a professional in writing codes or preparing other stuffs like that (like header files and thiiings like that)! am novice!!my problem is that can not compile my C codes using visual C++ 2005 beta 2!the first problem have encountered is that can not see any button or right click or left click menu for compliing the code like had been doing while using Microsoft Visual C++ 6.0!Secondly, I did open new project and file to write new code .After finished could not compile (that have used the shortcut buttns which have used while using Visual C++ 6.0 ) but again the code is not compiled.Later have moved a file with an extension into the 'projects' folder which was created as a default folder in 'My Documents' folder again I have tried to compile he code by using the shortcut buttons (I would be using Visual C++ 6.0) ( have used Ctrl+F7 to compile , F7 to build , and F5 to run the application code but always this message is displayed

'Unable to start the program c:/Documents and Settings/monica/My Documents/Visual Studio 2005/projects/example/debug/example.exe File is not found at the location'

Then have compared the content of the files in the Visual studio 2005 beta 2's folder and Visaual C++ 6.0's folder then realized some object files was absent in beta version's folder and really the example.exe was absent.

As have realised , the compiler is not able to create the files with exe entension so  how can I solve that problem and and execute my codes if u help will be glad thanks!!( IF U TELL HOW I CAN FIND THE COMPILE , BUILD AND RUN BUTTONS , I WILL GRATEFUL THANKS FOR YOUR INTREST!! IF U GET INTERESTED:)) 


Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Nazgob

Yes, you can compile C code. Take a look in project ->property pages -> C/C++ -> Advanced  and set Compile as a C option.

I'm not sure what's the problem with comilation -> I use F5 and it works very well :)
Try to do it by hand from menu -> Build -> Compile -> Build Solution
Then Debug -> Start with(or without) debugging.
Check also your project directory, there should be your_project_name.exe file in Debug subfolder.





Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

element

first thanks for your interest!!

the problem still exist . There is no such a directory project ->property pages -> C/C++ -> Advanced .After project->property pages , cant see a directory going on like  C/C++->advenced.

and second u have said try to it by hand. but again in menu Build -> Compile -> Build Solution (those options do not exist)also Debug -> Start with(or without) debugging doesnt work and exe file is still lost it is not int the place where it should be!!

please helpme what is going on here

thanks in advence!!!






Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Nazgob

I think you have a problem with making a project. If the project is not started some options are not present(most of them). How did you start project
I do it like this(for ansi C):
File->New->Project
I choose General-> Empty project
Now you have project but you want to do C not C++.
Open solution explorer(ctrl+alt+l)
Right click on source files -> add new item
Choose C++ file but name it in a C way: test.c
Remove all other cpp files from the solution explorer.
Now you have 1 C file in the project. Write sth simple and try to find the options from my previous post. Good luck!






Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

element

do not think have a problem with making a project.
let me tell how do.
File->New->Project
choose Win32 and Win32 console application
Then in the next screen press next and then in the next screen console application is marked and in that screen I choose empty project removing the tick next to the precompiled header file and then press finish button.(problem existed although have not removed the tick next to the precompild header file))
I got the project and want to create C code.
Again File->New->File

choose C++ file and after writing simple code save as C source file then again tried to compile, build and run the application( by using the shortcut buttons cus dont understand the configuration to compile, build and run

((here have a question as know can execute the code only preesing F5 ( mean only run command) because again as know if press run, code is compiled and built spontaneously)))  

 but again the message(which have mentioned in my previous post) is displayed.The simple:) code is that hello world application but it is not run by the compiler. 

#include <stdio.h>

#include <stdio.h>

int main() {

printf("\n Hello World !!\n");

system("pause");

return 0;

}

Still can not find compile, build and run in menu plz tell me need want to use Visual C++ 2005 beta 2plzz. did nearly anything  have reinstalled but agagin the problem exist.plz help me if it is possible and f u can  do thah for me suugest to meet on msn for your further help if it is possible!! or tell me in detailed what is happening and why can not compile my codes with Visual C++ 2005 beta 2 ((->>cus am succesful doing it in Visual C++ 6.0 by the same way but here it doesnt work)plz help me....

Thanks in advance!! 






Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Jonathan Caves MSFT

Did you check the compiler error messages If you compile the exact code shown above then compiler will not understand what "system" is and will generate the following error message:

xx3.cpp
xx3.cpp(9) : error C3861: 'system': identifier not found

To get this to compile you need to change one of the #include <stdio.h> statements above to #include <stdlib.h>







Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

element

sorry have written wrong in the message !!I know it should be <stdlib.h>.
 

#include <stdio.h>

#include <stdlib.h>

int main() {

printf("\n Hello World !!\n");

system("pause");

return 0;

}

and in real code it is like that but again thanks for your help!!but problem is not related with that plz read all the messege if u can to help me further!!

Thanks in advance!!




Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Tesfaye

Are you saying that you do not have a main menu item next to 'Project' which reads 'Build' This menu has sub menu-items for building your solution or compiling projects. Can you make your problem clearer again.



Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Jonathan Caves MSFT

Hi: I just followed your exact steps and I get exactly the same problem.

---------------------------
Microsoft Visual Studio
---------------------------
Unable to start program 'c:\documents and settings\joncaves\my documents\visual studio 2005\projects\hello2\debug\Hello2.exe'.

The system cannot find the file specified.

---------------------------
OK  
---------------------------

Here is what is going on:

When you select File.New.File... the file that is created is not associated with your project: so when you press F5 (which should compile and run your application) it fails as there is nothing to compile and hence nothing to execute.

There are two ways to fix this:

1) When you have created your empty project instead of selecting File.New.File... select Project.Add New Item... then select Code from the list on the left and then select C++ File. You can then add your code to this file. You should also notice, if you have the Project pane open, that the new file will appear in the list of source files associated with this project. The one problem with this solution is that it appears that it is only possible to add a C++ file to the project - there does not appear to be a simple way to add a C file.

2) The second solution is to do what you did before, use File.New.File.. to create a C file, but then you need to associate this file with your project. In this case after you have created and saved your C file you want to select Project.Add Existing Item... navigate to your new source file, select it and then click Add. Again if you have the Project pane open you should see this file appear in the list of source files.

Now if you press F5 the IDE will build and execute your project.







Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

element

really thanks!!thank for all who have efforrted to help me!!but but great thanks for Jonathan Caves due to testing the situation for me and helping me in the way how wanted to get !!

thanks all for their efforts!!

good luck eveyone!!!!!!!!!!




Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

noname00

I type the following code

#include
<stdio.h>

#include <conio.h>

#include <stdafx.h>

void main()

{

printf("Hello");

getch();

}

And this is the error message after i compile:

------ Build started: Project: Hoang, Configuration: Debug Win32 ------

Compiling...

ptb2.cpp

c:\tc\bin\hoang\hoang\ptb2.cpp(3) : fatal error C1083: Cannot open precompiled header file: 'Debug\Hoang.pch': No such file or directory

Build log was saved at "file://c:\TC\BIN\Hoang\Hoang\Debug\BuildLog.htm"

Hoang - 1 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========





Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Jonathan Caves MSFT

Please read this post:

http://forums.microsoft.com/msdn/ShowPost.aspx PostID=83790




Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

mveeravagu

I have Visual C++ Express edition. I have the same problem in compiling a simple C program. Can someone give me solution to this problem I tried but I am getting the same error as above.

Thank you

Morgan





Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

Brian Kramer

Which error The missing precompiled header error

If you are not creating a precompiled header (usually stdafx.cpp with the compiler flag /Yc:stdafx.h), then you should turn them off for your project. Under C/C++ settings, go to Precompiled Headers, and turn it off.

Brian





Re: Visual C++ General how to compile C code using Visual C++ 2005 beta 2 ??

mveeravagu

Set the Compiler option:

To set this compiler option in the Visual Studio development environment

1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

2. Click the C/C++ folder.

3. Click the Advanced property page.

4. Modify the Compile As property.

To set this compiler option programmatically

กค See CompileAs.

A direct aproach. There is no ambiguity in the word of science. That is why I gave the above steps.