This is the code:
Log:Code:#include <cstdlib> #include <iostream> #include <process.h> #include <windows.h> using namespace std; void Func1(void *P); void dramatic(void *P); CRITICAL_SECTION Section; int main(){ InitializeCriticalSection(&Section); _beginthread(Func1,0,NULL); _beginthread(dramatic,0,NULL); Sleep(5000); DeleteCriticalSection(&Section); return 0; } void Func1(void *P){ int Count; for(Count=1;Count<11;Count++){ EnterCriticalSection(&Section); cout<<"Func1 loop "<<Count<<endl; LeaveCriticalSection(&Section); } void dramatic(void *P){ int Count; for(Count=1;Count>0;Count++){ EnterCriticalSection(&Section); cout<<"Func1 loop "<<Count<<endl; LeaveCriticalSection(&Section); } return; }
Code:Kompilaator: Consoles Building Makefile: "C:\Programs\Dev-Cpp\Makefile.win" make... käivitus make.exe -f "C:\Programs\Dev-Cpp\Makefile.win" all g++.exe -c Templates/process.cpp -o Templates/process.o -I"C:/PROGRAMS/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/PROGRAMS/DEV-CPP/include/c++/3.4.2/backward" -I"C:/PROGRAMS/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/PROGRAMS/DEV-CPP/include/c++/3.4.2" -I"C:/PROGRAMS/DEV-CPP/include" Templates/process.cpp: In function `void Func1(void*)': Templates/process.cpp:24: error: a function-definition is not allowed here before '{' token Templates/process.cpp:24: error: expected `,' or `;' before '{' token Templates/process.cpp:32: error: expected `}' at end of input Käivitus peatatud



LinkBack URL
About LinkBacks


