Dev - C++ - Ayuda a compilar codigo

 
Vista:

Ayuda a compilar codigo

Publicado por _JanoXsky_ (1 intervención) el 10/06/2014 23:35:50
No tengo nada de experiencia en c/c++, quisiera compilar este code pero me tira error "Id returned 1 exit status".
No se si exporte bien recanalyst.h, estoy trabajando en dev c++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include <stdio.h>
#include <windows.h>
#include <wingdi.h>
#include "recanalyst.h"
 
void saveBitmapToFile(HBITMAP hBitmap, char *szFilename)
{
	HDC hdc = NULL;
	FILE* fp = NULL;
	LPVOID pBuf = NULL;
	BITMAPINFO bmpInfo;
	BITMAPFILEHEADER bmpFileHeader;
	do {
		hdc = GetDC(NULL);
		ZeroMemory(&bmpInfo, sizeof(BITMAPINFO));
		bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
		GetDIBits(hdc, hBitmap, 0, 0, NULL, &bmpInfo, DIB_RGB_COLORS);
		if (bmpInfo.bmiHeader.biSizeImage <= 0)
			bmpInfo.bmiHeader.biSizeImage = bmpInfo.bmiHeader.biWidth * abs(bmpInfo.bmiHeader.biHeight) * (bmpInfo.bmiHeader.biBitCount + 7) / 8;
		if ((pBuf = malloc(bmpInfo.bmiHeader.biSizeImage)) == NULL)
			break;
 
		bmpInfo.bmiHeader.biCompression = BI_RGB;
		GetDIBits(hdc, hBitmap, 0, bmpInfo.bmiHeader.biHeight, pBuf, &bmpInfo, DIB_RGB_COLORS);
		if ((fp = fopen(szFilename, "wb")) == NULL)
			break;
 
		bmpFileHeader.bfReserved1 = 0;
		bmpFileHeader.bfReserved2 = 0;
 
		bmpFileHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmpInfo.bmiHeader.biSizeImage;
		bmpFileHeader.bfType = 0x4d42; //'MB'
		bmpFileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
		fwrite(&bmpFileHeader, sizeof(BITMAPFILEHEADER), 1 ,fp);
		fwrite(&bmpInfo.bmiHeader, sizeof(BITMAPINFOHEADER), 1, fp);
		fwrite(pBuf, bmpInfo.bmiHeader.biSizeImage, 1, fp);
	} while (FALSE);
 
	if (hdc)
		ReleaseDC(NULL, hdc);
	if (pBuf)
		free(pBuf);
	if (fp)
		fclose(fp);
}
 
BOOL enumPlayers(RECANALYST_PLAYER player, LPARAM lParam)
{
	printf("%s; ", player.szName);
	return TRUE;
}
 
int main(int argc, char **argv)
{
	HMODULE hModule;
	recanalyst* ra;
	RECANALYST_PARAMS params;
	RECANALYST_GAMESETTINGS gs;
	RECANALYST_VICTORY vict;
 
	int RET_CODE;
 
	/*
	 * to support non-english language you can use following block of code:
	 * char *mapstyles[] = { "Standard", "Real World", "Custom" };
	 * printf("%s\n", mapstyles[gs.dwMapStyle]);
	 */
 
	if (argc < 2)
	{
		printf("Input file was not specified.\n");
		return EXIT_FAILURE;
	}
 
	if (!(hModule = recanalystLoadLibrary()))
	{
		printf("Unable to load library.\n");
		return EXIT_FAILURE;
	}
 
	if ((ra = recanalyst_create()) == NULL)
	{
		printf("Unable to create recanalyst object instance.\n");
		return EXIT_FAILURE;
	}
 
	params.lpFileName = argv[1];
	params.bShowPositions = TRUE;
 
	if ((RET_CODE = recanalyst_setparams(ra, &params)) != RECANALYST_OK)
	{
		recanalyst_free(ra);
		printf("%s\n", recanalyst_errmsg(RET_CODE));
		return EXIT_FAILURE;
	}
 
	if ((RET_CODE = recanalyst_analyze(ra)) != RECANALYST_OK)
	{
		recanalyst_free(ra);
		printf("%s\n", recanalyst_errmsg(RET_CODE));
		return EXIT_FAILURE;
	}
 
	gs.lpVictory = &vict;
 
	if ((RET_CODE = recanalyst_getgamesettings(ra, &gs)) != RECANALYST_OK)
	{
		recanalyst_free(ra);
		printf("%s\n", recanalyst_errmsg(RET_CODE));
		return EXIT_FAILURE;
	}
 
	printf("Map: %s\nPOV: %s\nPlayers: %s\n", gs.szMap, gs.szPOV, gs.szPlayers);
 
	if ((RET_CODE = recanalyst_enumplayers(ra, (EnumPlayersProc)enumPlayers, 0)) != RECANALYST_OK)
	{
		recanalyst_free(ra);
		printf("%s\n", recanalyst_errmsg(RET_CODE));
		return EXIT_FAILURE;
	}
 
	int size = recanalyst_getpregamechat(ra, NULL);
	if (size > 0)
	{
		char *chat = (char *)malloc(size * sizeof(char));
 
		if (recanalyst_getpregamechat(ra, chat) == RECANALYST_OK)
			printf("\n\npre-game chat:\n\n%s\n", chat);
		free(chat);
	}
 
	HBITMAP hBmp = CreateCompatibleBitmap(GetDC(0), 216, 108);
	if (recanalyst_generatemap(ra, hBmp, 0xFFFFFF) == RECANALYST_OK)
	{
		char bmp_filename[strlen(argv[1]) + strlen(".bmp")];
		sprintf(bmp_filename, "%s.bmp", argv[1]);
 
		saveBitmapToFile(hBmp, bmp_filename);
	}
 
	DeleteObject(hBmp);
 
	printf("\nAnalyzed in %dms.\n", recanalyst_analyzetime(ra));
	recanalyst_free(ra);
 
	return EXIT_SUCCESS;
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Ayuda a compilar codigo

Publicado por Pico (24 intervenciones) el 11/06/2014 09:15:53
¿No es eso sólo una cacho del error? ¿no es completo "permission denied, Id returned 1 exit status."?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar