-4

I want to learn C++ and I using YouTube, but there in code are modules conio.h and dos.h. But GCC don't knows them. Which whit the same functions I can use? (Any from another questions about this don't solving my problem)

I tried remove conio.h from code, but in the code, I have functions from it. That same with dos.h. After that, my text editor offered to me module coco_conio.h. What is that?

Functions , that I think that are from conio.h and dos.h:

#include <conio.h>
#include <dos.h>
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPosition;
void setcursor(bool visible, DWORD size) {
CONSOLE_CURSOR_INFO lpcursor;
lpCursor.bvisible = visible;
lpCursor.dwSize = size;
SetConsoleCursorInfo(console, &lpCursor);
getch();
if(kbhit()) {
Raymond Chen
  • 44,448
  • 11
  • 96
  • 135
Vioar
  • 3
  • 5
  • 4
    *and I using YouTube* -- Well, that's your first mistake. – PaulMcKenzie Dec 01 '22 at 18:25
  • 4
    A poor choice of tutorial, that's all. `dos.h` sounds like something for DOS, which is an ancient OS you're not using. – HolyBlackCat Dec 01 '22 at 18:26
  • 1
    are you using windows? – user253751 Dec 01 '22 at 18:27
  • It looks like you are trying to compile program for Windows without Windows SDK. Also, not sure if GCC will be able to work with it (probably not). Better to use msvc or clang-cl. – sklott Dec 01 '22 at 18:29
  • I guess there are good youtube C++ tutorials, I suggest you try and find one instead of flogging this dead horse. Make sure that any tutorial covers the operating system you are using and the compiler you are using. – john Dec 01 '22 at 18:34
  • Even if you got this to work, I can't see anything about that code that makes it suitable for a newbie learning C++. – john Dec 01 '22 at 18:36
  • @user253751 No, I using Arch Linux. – Vioar Dec 01 '22 at 18:38
  • @john I copied it from [this](https://www.youtube.com/watch?v=X4LyyvGLABg) video. – Vioar Dec 01 '22 at 18:40
  • 2
    @Vioar then you don't have these because they are from Windows – user253751 Dec 01 '22 at 18:40
  • 4
    Windows? Hell, they're from the stuff that *preceded* Windows. – user4581301 Dec 01 '22 at 18:40
  • Recommendation: Forget Youtube and the Internet for now and get an up-to-date C++ programming book. [Most of the introductory ones listed here](https://stackoverflow.com/q/388242/4581301) were written in the last decade-or-so. You'll learn enough from any of them to be able to recognize Internet material that isn't hilariously wrong, ridiculously out of date, or targeting different operating systems more often than you otherwise would. – user4581301 Dec 01 '22 at 18:46
  • @Vioar I watched that video, From what I saw the video has no audio, it's just a screen capture of him typing some code on his computer. How did you think you would learn anything from that? I'm amazed and shocked. If you want to learn to program then find a video that at least tries to explain concepts. You will learn almost nothing from just copying. Better still buy a book. – john Dec 01 '22 at 19:40
  • Worse, it looks like the code is being typed automatically. OP, this is an extremely poor choice of a tutorial. – HolyBlackCat Dec 01 '22 at 20:47
  • Could you show us the youtube link you are following. I 'm very curious to see how one managed to use DOS with gcc nowadays. – Michael Chourdakis Dec 02 '22 at 05:50
  • 1
    There are lots of muppets out there who go out of their way to get Turbo C running through MS DOS emulators, hacks, abstraction layers and so on. As if MS DOS programming in Turbo C was somehow the epitome in the history of programming. Particularly from a large country in the east with a poor school system that still uses Turbo C for teaching. Thousands of MS DOS programmers graduate from that country every year, prepared for their future careers working with single-threaded Borland BGI graphics. Or maybe as MS DOS influencers on social media. – Lundin Dec 02 '22 at 09:05

1 Answers1

0

This code here is a mix of the Windows API and old MS DOS libraries for the Borland Turbo compilers from 1989. You should be studying neither if your goal is to learn C++. gcc/mingw only supports Windows, not MS DOS nor 30 year old Borland-specific libraries.

General advise:

  • Don't search for knowledge or wisdom on Youtube.
  • Reading books or taking classes are still the best bets for obtaining relevant and correct knowledge.
  • If you are new to programming then starting with C++ is a poor choice, since it's by far the most complex programming language out there. Python, Java or C# might be more suitable as first language.
  • Study object-orientated design at the same time as you are learning programming.
  • Learning C before C++ isn't a bad idea since C++ is largely based on C and the languages have lots of similarities.
Lundin
  • 195,001
  • 40
  • 254
  • 396