How to Compile and Debug C++ in Notepad++ using Turbo C++ Compiler - c++

I have installed NppExecute plugin in notepad++. I am not able to figure out next step to compile and debug C,C++ programs in Notepad++.
System Details: (a) Turbo C directory C:\TC (b) OS Windows 7
Please provide complete details on how to set Environment Variable and Scripts for Compiling and Debugging.

Notepad++ has the run feature, but as far as I know it's unable to help you debugging (e.g. stepping through code, watching variables, etc.).
Your best bet would be using a simple batch file to compile the code and run your debug commands, but as far as I know you can't include everything into Notepad++ (i.e. it's no real C/C++ IDE).
Only option you've got is adding the created batch file as the program to be run by NppExecute.
Edit:
Overall, as rkosegi suggested, if possible, use a more up-to-date toolchain.
Microsoft's Visual C++ Express Edition can be downloaded for free and used for private or commercial projects.
If you target cross platform code, it might be easier to use MinGW to use GCC/G++ under Windows.

I wondering why somone wants to use turbo C++.If you run Windows, just use Visual Studio Express, or Dev-C++.If you still want to use Turbo C you will run into several problems with compatibility of this ancient software.

Related

Platform for c++ cross compile application

Currently, we are using MS Visual Studio and .NET to develop out applications on Window. We are in the process of porting the application to other OS (Linux, Android...etc) and want to get rid of MS Visual Studio and .NET stuff (they have been a pain to work with).
Is there any good development platform that you would recommend?
Thanks,
ABS
I would port the Visual Studio's solution/project files to CMake (in the downloads list you can get binaries for Windows and Linux), which allows you to generate project files for different platforms, allowing cross-toolset development. Eg:
On Windows, running CMake would detect Visual Studio and would generate solution and project files accordingly.
On Linux: running CMake would find, for instance, gcc or g++ and would generate makefiles accordingly.
I have not tried it, but for android's NDK there's this: android-cmake
[UPDATE Information on gcc/make for windows]
If you want to drop Visual Studio completely, you can try to set up the gcc/make toolchain for Windows with MinGW - Minimalist GNU for Windows, and port your solution/project files to makefiles.
Moving from Windows to other OS'es may shock you at first, but with time you'll get used to it: You do not need a "platform" or "IDE" per se.
What you will need, is cmake, gcc/g++, a decent text editor and perhaps a debugger frontend.
Optionally you may find ctags useful, Doxygen, an svn repo and a profiler (such as Valgrind/KCachegrind).
I am unaware of how exactly you can port .net stuff to C/C++ (other than re-writing from scratch).
Linux and OSX have many similarities, so porting from one to another should not be that hard. Android is a different story, although C++ for android has become a possibility.
The closest thing to what you are looking for, would probably be Eclipse or Netbeans, but again, the simpler you keep those things, the better IMHO.
As to getting rid of .NET, If your .NET code base is not in managed C++ in its entirety, I would try out Mono/Xamarin with Xamarin Studio IDE first before embarking on a full port of .NET code base to standardized C++.

Is there an open source for free tool for MS Visual C++ Express to build using gcc?

While the Microsoft compiler typically builds faster code, I'm in an environment where building Linux applications with gcc is required. I prefer MSVS and the Express versions as my IDE and have been able to configure it such that Intellisense and all the other nice features are working. However, I have been unable to find an easy way to get VC++ Express 2010 to build using gcc. I'm not sure if I remember correctly, but I thought about half a decade ago there was support to switch compilers when using MSVS.
I have found an extension to download claiming to do this, but it costs about $50. Does anybody know of any free or open source tools that can accomplish the above?
Try CMake: http://www.cmake.org/. It is a cross-platform, cross-ide build system. It will generate
VS project for you, and ordinary makefiles (or eclipse, or what you need).
Then, use VS to edit the code, and "make" to build it. I did it myself to develop windows + linux on virtual machine. And it worked fine.
As I realize there are no plugins, but you could simply setup some custom build rules and make gcc compile your project instead of the cl.
Google for the Custom build rules in Visual Studio / provide your own makefile. Also note that if you wish to still have the ability to debug your applications, you should probably look for something like WinGDB.
The good thing in this approach is that you can switch your configurations from cl to gcc, for example and easily test if your application remains compilable in both of them.
Still, the best way would probably be to use some automatic building tools like cmake or scons, which simplify the process greatly and can help you to switch to any other IDE in a matter of minutes.
Personally I like scons, because it's python-driven, but cmake is very nice to start from.

A simple "javac" style command-line C/C++ compiler for Windows 7

Over the last couple of months I practiced console programming with Java just with the help of JDK and a text editor of my choice (Notepad++). And I loved the simplicity as a program can be compiled from the command line plainly using javac and run using java.
Now, I'm looking for similar compiler for C/C++, such that I create a .c or .cpp file and compile it in the command prompt, and all it does is create a "native" executable that can be run directly from the command prompt. Thus, without any need of bloated IDE. The reason I'm looking for such simple compiler is because it is going to be used by high-school students so I'm advised to avoid any IDE as far as possible, so students can practice all the concepts of C/C++ languages without having to go for IDE. Which compiler can I use that does this job? also, I must work across all the versions Windows starting from Windows XP.
You can download MinGW which is basically GCC for windows.
Then you can simply gcc somefile.c to create an executable.
http://gcc.gnu.org/gcc is a multi platform c/c++ compiler
Visual Studio includes the ability to compile from the command line. Like others just said you can look at cygwin/MinGW. I would recommended using Code::Blocks or Dev-C++. I know you stated you do not want an IDE, but I would highly suggest a minimalist IDE like the ones I just suggested, or at least SciTE or Notepad++ to get some basic syntax highlighting with the ability to configure build tools if you want as well.
MinGW GCC is definitely the way go, but I would recomend the nuwen.net distro (http://nuwen.net/mingw.html). Haven't used it in a while (yay unix!), but if IIRC, it comes with everything ready to go after unpacking. The official distribution is ... very hard to get working.
A very simple solution woul be cygwin and MinGW, which provides an environment very similar to a UNIX shell. Then you can use the make utilities to compile your program.
You should certainly consider using MinGW GCC, but not by download from the MiNGW web page, unless you are some kind of masochist. Get the one packaged by Twilight Dragon Media at http://tdm-gcc.tdragon.net.
I too use VisualStudio on Windows from the command prompt and use VS Make files as well. That way, I can smb mount my source code from a different machine and perform compiles on several different platforms at once (e.g. Windows, Linux, Solarsi).

Linux app using C++ and visual studio

I want to write an app in visual studio that will work in linux. It's main function will be to monitor multiple linux systems and provide health and status to the GUI... I.e disk usage, bad drives, network throughput, mysql reads/inserts, ect... Can I cross compile with visual studio 2010?
Should I even bother using visual studio? Or should I bail and use Java or C++ on linux?
Thanks for the help guys, looks like the inevitable is true! I was just looking at netbeans, so I guess I will use that. I don't normally write for Linux, so I will just have to plow through it :)
Thanks
If you like the VS IDE, you can certainly use it to write code that's portable to Linux, though actually compiling the code for Linux will be separate. In theory, you could probably configure VS to compile your code with gcc as a post-build step, for example, but it would probably be more work than it was worth.
At least IMO, if you're trying write code that's portable to Windows and Linux (e.g., using Qt for its UI), and you're comfortable with VS, it's probably worth using VS to do most of the work. If you prefer Linux tools or you're writing the code exclusively for Linux, then you're probably better off using Linux tools throughout.
No; Microsoft Visual Studio does not contain a cross compiler for Linux. Nothing says you cannot use the C++ you build in Visual Studio on Linux machines though; you would just need to compile to code there.
As Visual Studio does neither run on Linux natively nor can it produce native Linux code, I would recommend you use the target platform's native toolchain to build your software.
If your goal is to create a portable application that runs on both Windows and Linux, starting one Windows with Visual Studio and recompiling the code on the Linux system on a regular basis is probably a pretty decent approach.
It is possible to use Visual Studio to develop, but you can't create the Linux executable with it - for that you need to use the gcc compiler under Linux. You'll find a few differences between the compilers that will give you some grief, and unfortunately a lot of those differences will be in the areas you're targeting - O/S services. It's a judgement call which would be easier but in your case I'd bite the bullet and use the Linux tools exclusively.
Bail.
Maybe look into monodevelop which is much less nice than Visual Studio.
Netbeans and/or Eclipse for linux are nice though.
Bail, Visual Studio is definitively not the best tool for this particular job.
If you want to code C++ for GNU/Linux, there are a lot of good IDEs in there: Eclipse, NetBeans, KDevelop, Codeblocks...
Also, check the answers on this question: C++ IDE for Linux?, I think you'll find some useful stuff there.
For what it's worth I've used VS to write code that was supposed to work on Windows and *nix. I'd figure out a configuration method for *nix and as you go before every major commit try compiling the code with gcc. Visual Studio's Intellisense and VC++ debugger murder Eclipse+CDT+gdb in every way.
I'm fairly partial to Qt Creator for my x-platform C++ tasks.

How do you try out small/simple C or C++ source codes?

It is very easy on Linux to fire-up vi and write a 100-200 lines of code, compile and see the results: ie. Trying small simple examples of C/C++ code.
On windows however, I like Visual Studio but to use it you have create a new solution then a project which then creates a new folder, generates very large PDB and caching files and a small example of 100-200 LOC becomes a 20Mb large project(?!) after compilation.
So the question is how do you write this kind of small codes on Windows? Possibly Cygwin or Dev-C++ (which is not active since 2004?).
You can compile from the command line using cl.exe. See the MSDN article How to: Compile a Native C++ Program from the Command Line for detailed instructions.
When you installed Visual Studio it created an entry in your programs named something like "Visual Studio Command Prompt" (maybe in a group "Visual Studio Tools").
Execute that Command Prompt (it sets up some environment variables needed for the command line compiler) and use cl, the command line compiler.
> cl /?
Copyright (C) Microsoft Corporation. All rights reserved.
C/C++ COMPILER OPTIONS
-OPTIMIZATION-
/O1 minimize space /O2 maximize speed
/Ob<n> inline expansion (default n=0) /Od disable optimizations (default)
/Og enable global optimization /Oi[-] enable intrinsic functions
...
Edit -- copy from another answer :)
Microsoft Documentation: VS2005, VS2008
For the simplest examples codepad may be an option.
I think there's nothing wrong with firing up Visual Studio for some testing. You can delete the 20MB afterwards ;)
However, you can also just invoke the command line compiler on Windows. Just start a Windows SDK console (or Visual Studio console) and you're there. And you can even use vi (need to install it first, of course).
I always use MinGW (GCC for windows) for such tasks.
MinGW is a good solution if you're not using anything Visual Studio specific. If you are, in the start menu with Visual Studio, there should be a script that starts a "commandline" for visual studio.
Also, please keep in mind, even if you aren't going to use Visual Studio, if you use MinGW, you're going to run into issues even with things you might not expect (like...if you decide to try the Apple Bonjour SDK, in which case you're going to get nasty link errors) because GCC and MSVC++ libraries don't always play nice.
And if you don't have access to your local computer, or you are to lazy to look for command line compiler you can paste your code to on-line compiler. There are several of them on the net you can try one of them here. It's free, no registration needed. It has some flaws but for quick code check it's just fine.
You can also use some other languages, C, C++, D, Haskell, Lua, OCaml, PHP, Perl, Python, Ruby, Scheme, Tcl to be precise.
Maybe I'm just a *nix geek, but I went on over to http://consoletelnet.sourceforge.net/gccwin32.html and got gcc for win32. I then headed over to http://unxutils.sourceforge.net/ and go these command line tools. (I renamed their find.exe to gfind.exe to avoid conflict with windows find). I then use gvim for win32 to write code and make/gcc to compile it. Now I only have to learn one environment.
For small bits of code I want to test, such as code that I'm going to include in an SO answer, I always use the command line. My tools on Windows are:
the MSYS tools, particularly their bash shell
the vim editor
the MinGW GCC compiler (Twilight Dragon branch)
I haven't used any of them, but MinGW and lcc-win32 seem to be pretty lightweight, and people seem to like them in news:comp.lang.c. MinGW is a port of GNU Compiler Collection for Windows and is free, lcc-win32 is free for non-commercial use.
You can do the exact same thing for Windows -- fire up VI and run the output through gcc.
Either get MingGW/MSys, Cygwin, or native ports of each app (gnu tools, vi)
Just because you're using Windows, doesn't mean you're forced to use Visual Studio.
I've got a Visual Studio test project with a main file I just overwrite every time I want to test something new. The couple of MB taken up by the .ncb file really really really doesn't matter. A bigger issues is the need to create a project. But I get around that by reusing an old test project.
For small/simple C or C++ source codes I use Ideone. It supports over 40 programming languages.
I usually edit my code within notepad++ then compile it with gcc under cygwin or msys.
I have used Dev-C++ post 2004, and it still works quite well.
I even used projects coded in Dev-C++ for my practicals that had to run on machines using Linux. Just changed the make files.
I also use Visual Studio; for quick testing and prototyping, I have a file scratch.c on my desktop, which I just load up and test things out in.
I don't see opening Visual Studio, clicking the new document icon, writing code, pressing F5 then just accepting the defaults for everything as being too much effort :)
The other alternative I have (which I don't use for C, but do for Haskell) is to PuTTY into a Linux box I have access to, and do everything on there.
I have a Test.sln which has a Test.vcproj which has a Test.cpp. The solution has a few handy configurations (for maximum C++ std conformance and others). I just paste code into/from the Test.cpp file and compile it that way.
I use cl.exe and nmake.exe from Visual C++ Express to compile small groups of .c and .cpp files. Rolling your own simple Makefile for nmake.exe is easy.