• Compiling C#
    21 replies, posted
I'm using VC#2008 and I have written a simple "Hello World" application, but can't find out how to compile the program. Yes, I have used :google:
Search for some button saying 'Build'. Maybe you could also right-click your project and select it.. I don't use VC#...
-snip-
Press F7
F7 didn't do anything. [editline]08:59PM[/editline] This is a picture of my code as their seems to be something wrong with it [IMG]http://i47.tinypic.com/20rmvwm.jpg[/IMG]
Start a new project. The file must be in a project before it can be compiled.
First make a new project, suggest you start out with a Console application as that is what you are about to write, then you write some code in the program.cs then you press F5 to build and run with debugger.
[QUOTE=Nisd;18440797]First make a new project, suggest you start out with a Console application as that is what you are about to write, then you write some code in the program.cs then you press F5 to build and run with debugger.[/QUOTE] I don't see why people are rating you late. You're the first one with the actual answer.
[QUOTE=Agent766;18519143]I don't see why people are rating you late. You're the first one with the actual answer.[/QUOTE] I do believe that my answer directly above his post was a more concise version of what he said.
[url]http://msdn.microsoft.com/en-us/library/1700bbwd%28VS.71%29.aspx[/url]
[QUOTE=Senney;18519397]I do believe that my answer directly above his post was a more concise version of what he said.[/QUOTE] I guess you're right. But that doesn't mean I agree that he deserves lates :P
[QUOTE=Roddy;18519406][url]http://msdn.microsoft.com/en-us/library/1700bbwd%28VS.71%29.aspx[/url][/QUOTE] Indeed this is also a correct method for compiling C# code, however writing your code within a project adds quite a lot of advantages than otherwise: - Code completion - File management within one dedicated window. - One-button compile and run - Easy breakpoints and debugging I'm not trying to insult your solution, it's a perfectly valid solution to the problem at hand, I'm just hoping to help others who may come here looking for solutions with choosing the one that is the best for them.
[QUOTE=Senney;18521683]Indeed this is also a correct method for compiling C# code, however writing your code within a project adds quite a lot of advantages than otherwise: - Code completion - File management within one dedicated window. - One-button compile and run - Easy breakpoints and debugging I'm not trying to insult your solution, it's a perfectly valid solution to the problem at hand, I'm just hoping to help others who may come here looking for solutions with choosing the one that is the best for them.[/QUOTE] You should have given the solution.
[QUOTE=Roddy;18521811]You should have given the solution.[/QUOTE] I did provide a solution?
[QUOTE=Senney;18529666]I did provide a solution?[/QUOTE] [quote]Start a new project. The file must be in a project before it can be compiled. [/quote] It isn't required, you stated it must be, could have also the command line solution.
It's required in order to compile from the IDE, which is what TheChantzGuy is attempting to do. In any case, suggesting command line compiling to a beginner programmer is asinine. I think of myself as pretty experienced with compiling C# and C++ projects, but you'll never see me doing it from the command line. Make files and IDEs trump any reason to directly invoke a compiler.
On noobie questions, my hello world app wont work either, it just says there was an error. [code]int main () { cout << "Hello World!"; return 0; }[/code] It says it is out of date.
[QUOTE=ThePunisher1;18543638]On noobie questions, my hello world app wont work either, it just says there was an error. [code]int main () { cout << "Hello World!"; return 0; }[/code] It says it is out of date.[/QUOTE] Maybe the problem is that your code is C++, not C# :downs: Add this before anything: [code] #include <iostream> using namespace std; [/code]
[QUOTE=Simspelaaja;18544228]Maybe the problem is that your code is C++, not C# :downs: Add this before anything: [code] #include <iostream> using namespace std; [/code][/QUOTE] Yeah I am using the tutorial posted in the stickie, tried that aswell, does not seem to compile though :S
Still, wrong thread. You should make a new one.
[QUOTE=Simspelaaja;18544228]Maybe the problem is that your code is C++, not C# :downs: Add this before anything: [code] #include <iostream> [/code][/QUOTE] Fixed. Add std:: when you need it.
wow
Sorry, you need to Log In to post a reply to this thread.