Thursday, July 30, 2009

Can you make C++ run in NotePad?

Hi, I'm learning JavaScript and I am doing so much better that I thought I would have at this stage and I decided that I want to pick up C++ as well. I downloaded Microsoft Visual C++ 2008 Express Edition, but the user interface is so confusing and I just want to know if I can make C++ programs run in NotePad, and if I have to save it in a different extension (like .html for JavaScript) or something.

Can you make C++ run in NotePad?
No, if I'm understanding your question correctly.





C++ needs to be compiled and then built into a program, you can't just say double-click on it to run it. If you save it in a file and are hoping to run it like javascript, you are sorely mistaken.





What you can do is this though, create your project in Visual Studio and then edit your files in notepad and then switch back and forth, editing in notepad and then building in Visual Studio.





But I suspect that's not really your problem.





I suspect your real issue is that you don't really understand how to create a project of the type you want or don't understand the idea of a C++ project. I'd say look at the File menu, there should be a "New Project" thing there of some sort with a wizard and just say "command line program" if that's what you're trying to do and it will create the project with just one cpp file with main() in it, then you can edit away on that single file, or again do the notepad edit/visstudio build thing if for some reason you find notepad way better than the visstudio editor (I don't really understand why you would frankly). Then hit F5 to run. That's it for the very basics I guess.





Hope that helps!
Reply:Well you can't run it in notepad, but yes I think I have written C++ in Notepad.
Reply:yup you still can just name it .cpp
Reply:yeah you can.





i think your confused though, you cannot compile in notepad. Compile means to take the code you wrote and translate it into machine code so the virtual operating system can understand it.





just save the format as .cpp and press the play button in visual studio or express etc... it will compile it for you.





Try the Dev-C++ Complier! : www.bloodshed.net , its much cleaner and easier.
Reply:Download Notepad++. It's so much better than regular notepad.
Reply:save as exe file and try if it runs
Reply:You can write them in notepad and save them as ".c" and or ".h" files that you can then compile and use in C++
Reply:You can write it in notepad but you need the compiler to run it.
Reply:you can use any word processor to create c++ code. the file extension for the uncompiled code is .cpp . You will have to use a compiler though to test your code.


No comments:

Post a Comment