How to use old commands in new compilers? [duplicate] - c++

This question already has answers here:
Conio.h not working in codeblocks (Undefined reference to ..)
(5 answers)
Closed 7 years ago.
I am making a record entry system in C++. In this system, I need to use commands like gotoxy,clrscr,sound,nosound,etc. I work in Code::Blocks IDE and use a GNU GCC compiler. For the gotoxy command, I even downloaded the header file but still it does not work. Can anyone give me the code or the duplicate of these functions.Thanks!

The problem is that <conio.h> does not work on modern compilers . It only works on old IDE's ones like TurboC++ and DevC++ ( They are very old, TurboC++ was used in the 20th century, no one hardly uses it anymore ). So, in short, it won't work unless you get an old compiler ( which is not a good idea ).

<conio.h> is ancient.
<conio.h> was commonly used in Turbo C, to manipulate the console input/output. This was prominent in the old DOS age, where most of the things were command-line.
As for now, <conio.h> is not supported in gcc.

Related

Iostream in Borland C++ compiler [duplicate]

This question already has answers here:
Difference between iostream and iostream.h
(3 answers)
Closed 4 years ago.
In my old computer (nearly 15years), I use MsDos and Borland C++ compiler.
The problem is,
#include <iostream.h>
works but
#include <iostream>
using namespace std
This doesn't works here.
Is there any way to use modern IDE on MsDos
Borland is so old that it was made before the C++ Standard Library existed.
At that time the effective standard for C++ was the ARM, the Annotated Reference Manual by Bjarne Stroustrup and Margaret Ellis, and it was named <iostream.h>.
With the first standardisation in 1998 <iostream.h> was dropped, and replaced with just <iostream>.
I don't know what to say. Just use <iostream.h>, or a newer compiler.

Forward slash or backslash when declaring includes on C++ [duplicate]

This question already has answers here:
Is the backslash acceptable in C and C++ #include directives?
(6 answers)
Closed 5 years ago.
I had always used <bits/stdc++> library for my codes, however, I noticed that <bits\stdc++.h> works as well on CodeBlocks 16.01 on GNU GCC compiler, Windows 7/10 environment.
My question is Which of those is right, and if not both, why is one wrong?
I have successfully compiled code with that include in more than one computer.
Which of them is right, if the both are not, why is one of them right and the other one not?
Only the forward slash / is right. Compilers under Windows systems use an extension that can handle both.

Compile C++ program without .NET Framework [duplicate]

This question already has answers here:
Standalone VS 2010 C++ Program
(5 answers)
Closed 7 years ago.
I'm trying to compile my c++ program I wrote without using .NET Framework (I needit to be, at the end, an EXE file).
These are my includes:
stdio.h, tchar.h, windows.h, string.h, iostream, thread, Wbemidl.h, memory, algorithm, WinHttpClient.h, functional , cctype, locale.
When I try to compile and run this program in VS (adding the stdafx.h) the program works just fine, but it compiles with the .NET framework.
How can I compile it without the .NET Framework? Is it even possible? (I believe it is but I'm asking anyway).
I tried to use both mingw32 in Ubuntu and code::blocks in windows. Maybe I'm doing something wrong?
Thank you.
Edit:
This question is not the same as the question you marked mine to be similar to.
I can't and I don't want to rely on the fact that the destination computer has redistributable packages or .NET or some MSVCP. In the end, this program should work on Windows XP and above and on most of the Linux distributes.
Please, I need your help. I might said something wrong earlier in this topic, and I'd like you to explain me my mistakes and also, I still need your help to compile this.
I tried to change the settings you told me on VS, to /MT in the code generation settings, but it gave me even more errors that it cannot open some source files, which makes even more error.
I thought about leaving VS 2015 and move to code::blocks on Ubuntu, even compiling with the MingW32 itself, but it writes me "undefined reference to..." 49 times (all the functions defined in the header files I included).
I'd really appreciate any help.
Do you actually know, what the difference between .NET and WinApi is?
If you plan to code without .NET you should have a look at win32developer.
An alternative would be to use Qt, which I warmly recommend you to use.
.NET provides many functions for networking and window handling etc. like Java but it is WINDOWS ONLY and since you don't want to depend on .NET you have to either implement it yourself or get another package like I suggested above.

Using eclipse to compile c++ [duplicate]

This question already has answers here:
Getting C++ to compile inside Eclipse
(2 answers)
Closed 9 years ago.
I am new to c++ but have some programming experience with R and Matlab. My OS is Win 7.
I downloaded " Eclipse IDE for C/C++ Developers " from Eclipse website and tried to run a simple program, but the compiler doesn't even know "cout", the simplest c++ command.
I do see some answers on the website, but it is still a little hard for me to follow.
Eclipse CDT: Symbol 'cout' could not be resolved
First of all, should I install "Eclipse Standard 4.3" ( the so called platform?) or " Eclipse IDE for C/C++ Developers " ? Most of the documents I found on the web use the platform rather than C++ IDE.
Could someone recommend a step to step guide (guide for "idiot" like me ) for programming c++ with eclipse?
Thank you very much!
Either the C++ specific version or the standard version should work. What I believe is happening with you is that you don't have a C++ compiler installed. gcc is the most popular one, just Google it. Do note that Eclipse is not a compiler and it does not include a compiler, either.
As for a guide, a quick google search found the Eclipse C++ documentation. As you are new to StackOverflow, please be sure to read the guidelines, and go over the about page to get acquainted with how the site works.
Also see this related question. Let me know if you have any questions, and welcome to the community!
My suggestion on the matter, if you are new to IDEs, you may want to start with Visual Studio. It is very easy to use, and the express edition is free. I believe it includes a C++ compiler as well.

Cross compilation tutorials [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Cross platform programming
I've written some code using wxwidgets in c++. But I am not able to compile the same code for both windows and linux. Actually I'm a bit scared by the preprocessor directives generated by code-blocks ide. I wonder if anyone could point out some nice tutorials for learning cross-compilation.
Thanks in Advance
Jvc
If you want to build a cross platform program, you will stumbl across a few kind of problems.
Cross compilers problem
Some compilers are offering non-standard functionalities that might not work on other compiler. You have to make sure that compiler functionnalitie's you use are standard or available on all the compilers you use (An exemple would be the VC++ #pragma that wasn't usable on gcc until version 4.2.1)
Platform specific functions and libraries
Guess what, if you include <windows.h> it won't compile on a linux system (this is madness I know). So you must try to avoid those platform specific libraries/function. If you ever have to use them, try to encapsulate their use and select the specific class you need to compile on different system.
Here is a wonderful guide posted by the Mozilla foundation :
https://developer.mozilla.org/en/C___Portability_Guide
You could have a look at Cross Compiling wxWidgets Applications on Linux (Code::Blocks wiki) and Cross-Compiling Under Linux (wxWiki). There is also a section on cross compiling Windows applications in Brent W. Woodruff C++ Introduction to wxWidgets.