S
S
SkyDatter2020-01-04 14:22:45
Windows
SkyDatter, 2020-01-04 14:22:45

Why doesn't g++ from MinGW-w64 know about _beginthread and conio.h?

Hello! I can't figure out how to compile a program in g++ (MinGW-w64) for Windows. I compile like this:
g++ -o app.exe app_source.cpp
g++ swears that the conio.h file was not found. In addition, the _beginthread function must be declared in the process.h file. This is written on microsoft.com .
Compiler output:

spoiler
C:\xcvbnm>cmd.exe
Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

C:\xcvbnm>g++ -o app.exe appsource.cpp
appsource.cpp:6:10: fatal error: conio.h: No such file or directory
 #include <conio.h>
          ^~~~~~~~~
compilation terminated.

C:\xcvbnm>g++ -o app.exe appsource.cpp
appsource.cpp: In function 'void thread_proc_example(void*)':
appsource.cpp:14:2: error: '_endthread' was not declared in this scope
  _endthread();
  ^~~~~~~~~~
appsource.cpp:14:2: note: suggested alternative: '_hread'
  _endthread();
  ^~~~~~~~~~
  _hread
appsource.cpp: In function 'int main(int, TCHAR**)':
appsource.cpp:21:2: error: '_beginthread' was not declared in this scope
  _beginthread( thread_proc_example, 0, 0 );
  ^~~~~~~~~~~~
appsource.cpp:21:2: note: suggested alternative: 'OpenThread'
  _beginthread( thread_proc_example, 0, 0 );
  ^~~~~~~~~~~~
  OpenThread

C:\xcvbnm>

I want to build an application that uses only i386, which does not pull any libraries (like cygwin1.dll), and whose crt will be statically linked, that is, so that it can be run on both win98 and win10.
What should I do to make it compile? Or what to read to understand?
Source:
spoiler
#include <windows.h>
#include <process.h>
#include <stddef.h>
#include <stdlib.h>
//#include <conio.h>
#include <stdio.h>
#include <tchar.h>

using namespace std;

void __cdecl thread_proc_example( void* param )
{
  _endthread();
  return;
}

int main( int argc, TCHAR* argv[])
{
  MessageBoxA(0, "String 01\n", "String 02\n", MB_ICONINFORMATION);
  _beginthread( thread_proc_example, 0, 0 );
  return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Radjah, 2020-01-05
@SkyDatter

conio.h: No such file or directory
There is no such file in /usr/includeyour installation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question