How can I compile code that uses graphics.h in DOSBOX? - c++

i write a code and in this code i use graphics.h ,in borland c++ or visual I can't open and run it, now i want run this code ,and i have DOSBOX 0.72 , how open this code with DOSBOX?
my windows is 7 32bit

I see you're still trying to write and compile code that uses legacy and unsupported libraries...
At least you've discovered now that you aren't going to be able to do this natively in Windows 7, and have installed a DOS emulator. Now, you'll need to find and download a compiler that will run in that environment.
Since graphics.h is a proprietary Borland library, I recommend you use one of their compilers. The company who now owns Borland hosts an online museum of their vintage products that are free for download. Grab a copy of Turbo C 2.01 or Turbo C++ 1.01, load it on your DOSBOX, and marvel at the little piece of computer history you've unearthed.
Also, Turbo C 3.0 is available online from here, but I'm not sure this has been released to the public domain. I can't imagine anyone would really care, but legally and all, you're on your own.
But seriously, why not download Visual Studio C++ 2010 Express free from Microsoft and use a modern compiler instead? Sure you can't use graphics.h, but there have been a significant amount of developments made in computer graphics technology in the past 25+ years. A modern IDE will be much easier to use than the old Borland compilers, and the time you invest will actually be worth something.

May be download and install borland c++ 3.11 compiler and use graphic.h library (i'm use it 4 years ago).
I think that this compiler isn't ran in Win 7, but may be try.
You can use Virtual Box, with installing Win XP (borland c++ 3.1 100% work in WinXP).

The complete solution of running turbo C++ 3.0 in windows 7 is just disable graphics driver of your computer from device manager and use like windows Xp.
It will run turbo c++ in full screen as well as run graphics program in windows 7

Related

Is Intel OpenCL SDK available for Windows 11?

I want to run some C++ on my Laptop GPU with Windows 11. I saw in the Internet that I need the Intel OpenCL SDK. I tried to download it, but I got a warning that it's only recommended for Windows 10. I still continued with the installation, but i can't find all the C++ header files. Is that because I use Windows 11 or is there another reason for this?
I thought that the Download would contain all the OpenCL header files and so on.
You don't need the Intel OpenCL SDK for OpenCL development. All you need is the graphics driver, which probably is already present, and the OpenCL header files. For how to set it up in a Visual Studio Community project, see here; this works for Intel/AMD GPUs too, and on both Windows 10 and 11.

CPP graphic.h in codeblock

I have included graphics.h in Codeblock and used initgraph() to rezise my console window. It can compile but it only outputs a default black window which return "Process returned -1073741819 (0xC0000005) execution time : 2.970 s
Press any key to continue.."
#include <iostream>
#include <graphics.h>
using namespace std;
int main(){
initgraph(1000,800);
getch();
closegraph();
}
Solution:
Abandon graphics.h and use a modern graphics library. graphics.h is the header for the Borland Graphics Interface (BGI), a library shipped with the Borland development tools of the 1980s and early 1990s and intended for use with the DOS operating systems. It is old. Use of it professionally is exceptionally rare, so there is minimal value in learning it when you could be learning a graphics library that is used professionally and supported by modern development environments and hardware. For example, the graphics tools built into SFML and SDL.
If this is for school and you must use an implementation of graphics.h to satisfy the marking criteria, either
Exactly duplicate the set-up used by the marker. This minimizes the risk of differences between your environment and the marker's resulting in a program the marker cannot mark. You may be able to make a virtual machine that emulates the the marker's environment.
Download, install, and configure a modern implementation of graphics.h like SDL_BGI (Source if you need to build it yourself). The risk here is you may write code and use functionality that is not available to the marker's environment or write code that behaves differently.
What's likely happening:
As I recall the implementation of graphics.h most commonly suggested online required GCC3.4, and the odds of you getting Code::Blocks with GCC less than 4.8 these days is astonishingly small. And even version 4.8 is horribly out of date. Mainstream GCC is on 10.2.
To add to the fun, the library will have been written to run on the then-flagship Windows XP operating system and the graphics cards available at the time. Both have changed dramatically since then. So even if you track down GCC 3.4, successfully install it, and configure Code::Blocks to use it, you may find yourself needing Windows XP and a vintage 2005 graphics card because there's no way Windows XP will have a driver for whatever graphics card you are using.
This means your code can be 100% correct but the library you are using simply does not run as expected with the tools you're using. Your only option is to use other tools or use a different graphics library.

Compiling C++ for OSX from Windows

I have a small console based, standards compliant, C++ program that I developed in Visual Studio on Windows. Since it is in standard C++, is all I need to do is compile it for OSX? or am I being overly optimistic?
I am looking for the easiest and most straightforward way to do this. Is it possible to do from Visual Studio 2012 Professional? If necessary I have access to a Mac. However, since my dev platform is Windows, it would be nice if I could do it from here.
I'm not experienced with mac development at all. When you compile an application for OSX, what do you get instead of a .exe?
If you don't mind installing MinGW or Cygwin to your Windows machine, you can build a Windows to OS X cross-toolchain as per the instructions here: https://github.com/Tatsh/xchain
I would get an OSX system (a VM is fine), install XCode and then compile your code using that. Should be trivial if your C++ code is written in a cross platform way.

Best alternative for Visual C++? VS11 Express can't be used to write desktop apps

Some of you might already know that Microsoft is trying to kill desktop development in favor of Metro style apps. The express editions of the new Visual Studio 11 will only support writing Metro style apps. They also won't give you the new compilers as part of the new Windows SDK. The only way to get the compilers is to buy Visual Studio Professional or higher.
Now it's time to find an alternative (alternative compilers for the Windows platform). Any suggestions?
Some links that are related to this issue:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2645679-visual-studio-11-express-on-windows-7-and-the-abil
http://blogs.msdn.com/b/visualstudio/archive/2012/05/18/a-look-ahead-at-the-visual-studio-11-product-lineup-and-platform-support.aspx
http://www.microsoft.com/visualstudio/11/en-us/products/express
Gcc/G++ of course. In my opinion it is superior to VC++. In addition, you can use Eclipse CDT as IDE, it is quite usable at the moment (compared to older versions). I work like that on Windows. In addition, you can also work on Linux or MacOS without having to switch to another tool.
1) The Metro and WinRT features are accessible from C++/CX which in turn is built on top of COM, so according to this detailed discussion (SO question on WinRT and C) you can use the latest "Microsoft-only" features with any decent C compiler. Of couse this will require some code generation or just a lot of typing to get the access to basic facilities. I believe there would be a transition period and then the open-source community comes up with some automated solution to consume the WinRT APIs.
2) A quick list of available options right now.
Dev tools: MinGW or Cygwin (GCC toolchain + unix-like tools), Clang maybe, OpenWatcom as a thing from the past
GUI Libraries: FLTK, Qt, wxWidgets, Fox GUI toolkit, librocket (if you are into the OpenGL world)
IDEs: Code::Blocks, Eclipse+CDT, QtCreator
3) There's also a non-C++ way:
The FreePascal+Lazarus to allow Delphi-like RAD
Mono/SharpDevelop
Both options can use C++ code with some bindings.
4) Conclusions
These are the alternatives which give similar results but not always the similar level of comfort.
Yet another possibility would be Qt Creator, which comes with a full toolset targeting Windows (as well as MacOS, Linux, and Symbian). It is definitely somewhat different from VS, so it takes some getting used to, but overall I'd rate it as pretty decent. Qt (the library) generates somewhat mixed feelings -- some dislike its oddities (E.g., MOC), but quite a few consider it the best designed GUI toolkit available.
Don't forget the Netbeans GUI which is also available for windoze. It works great, just install mingw and choose this mingw/bin directory for the compiler tools and mysys/bin/make.exe as the make program
to download
https://netbeans.org/downloads/index.html
they have this plugin for vc++
http://plugins.netbeans.org/plugin/42519/vcc4n-visual-c-compiler-for-netbeans
some install info
https://netbeans.org/community/magazine/html/03/c++/
Another IDE that I havent used but looks good is
http://www.codeblocks.org/

Is there any way to obtain antique versions of Borland's Turbo C++ compiler for free?

I am looking for an old version of the Borland Turbo C++ compiler. However I have to get it in legal way. Has anyone heard something about discounts for such old compilers?
[EDIT]
I would like to publicize my old sources for educational purposes, however they will only compile on this old compiler. I want to show my blog readers what mistakes they should try to avoid while learning a new language.
So It would be great if anyone could download the sources and compile them on their own computer. Therefore, I hope that maybe after so many years, Borland would give these old versions to the public for free...
Embarcadero, the company that now owns Borland's developer tools, gives away a lot of their antique software for free. Turbo Pascal 1.0, 3.02, and 5.5 are available, as are Turbo C 2.01 and Turbo C++ 1.01.
You can download the offerings here (the page is extremely slow, but it will load eventually).
And thanks to Alain Pannetier, who informs us that a slightly newer version, Turbo C++ 5.5, is also available as a free download.
But uh, if you're just looking for a freely downloadable C++ compiler, there are much better options, no time machine required. Check into GCC and/or Microsoft Visual C++ Express.
Are we talking about Pascal or C? There are freeware equivelents that I've used to compile ancient Turbo Pascal projects without a problem (FPK Pascal is one).
Ah, I miss pascal. And quiche.
here are two links for sites that sell old Borland software:
http://www.recycledsoftware.com/servlet/the-BORLAND-C-pls--pls-/Categories
http://www.emsps.com/oldtools/borland.htm
P.S. Why can't you compile the code with a newer compiler? Is it the C++ language
or the libraries you are using?
Jogy