Answer the question
In order to leave comments, you need to log in
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:
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>
#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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question