Compiler Error When Running build.sh
mardymia opened this issue · 3 comments
I'm a bit of a newbie with C++, and I'm not sure if I'm doing something wrong, but when I try to run 'build.sh', nothing happens, and when I run it on the Terminal, I get the following compiler error:
`PS C:\Users\MYUSERNAME\Downloads\automatic-bars-patcher-1.0.0\automatic-bars-patcher-1.0.0\pc> g++ -O2 -pipe main.cpp -o auto_bars_patcher -Wall -Wextra
In file included from main.cpp:9:
../bars-patcher-core/bars-patcher.h: In function 'unsigned char barspatcher_run(bool, const char*, const char*, const char*, const char*)':
../bars-patcher-core/bars-patcher.h:101:5: error: 'uint64_t' was not declared in this scope
101 | uint64_t bars_size;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:22:1: note: 'uint64_t' is defined in header ''; did you forget to '#include '?
21 | #include <dirent.h>
+++ |+#include
22 | #elif defined BARSPATCHER_VERSION_NX
../bars-patcher-core/bars-patcher.h:111:9: error: 'bars_size' was not declared in this scope
111 | bars_size = ifile.tellg();
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:147:5: error: 'uint16_t' was not declared in this scope
147 | uint16_t mod_dir_list_count = 0;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:147:5: note: 'uint16_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:163:27: error: 'struct dirent' has no member named 'd_type'
163 | if(mod_dir_entry->d_type != DT_REG) continue;
| ^~~~~~
../bars-patcher-core/bars-patcher.h:163:37: error: 'DT_REG' was not declared in this scope
163 | if(mod_dir_entry->d_type != DT_REG) continue;
| ^~~~~~
../bars-patcher-core/bars-patcher.h:165:22: error: 'mod_dir_list_count' was not declared in this scope; did you mean 'mod_dir_list'?
165 | mod_dir_list[mod_dir_list_count] = (char*)malloc(strlen(mod_dir_entry->d_name)+1);
| ^~~~~~~~~~~~~~~~~~
| mod_dir_list
../bars-patcher-core/bars-patcher.h:173:25: error: expected ';' before 'i'
173 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:173:44: error: 'i' was not declared in this scope
173 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:191:25: error: expected ';' before 'i'
191 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:191:44: error: 'i' was not declared in this scope
191 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:200:8: error: 'mod_dir_list_count' was not declared in this scope; did you mean 'mod_dir_list'?
200 | if(mod_dir_list_count == 0) {
| ^~~~~~~~~~~~~~~~~~
| mod_dir_list
../bars-patcher-core/bars-patcher.h:211:13: error: expected ';' before 'patched_files'
211 | uint16_t patched_files = 0, skipped_files = 0;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:235:17: error: expected ';' before 'entry'
235 | for(uint16_t entry=0; mod_dir_list[entry] != NULL; entry++) {
| ^~~~~~
| ;
../bars-patcher-core/bars-patcher.h:235:40: error: 'entry' was not declared in this scope
235 | for(uint16_t entry=0; mod_dir_list[entry] != NULL; entry++) {
| ^~~~~
../bars-patcher-core/bars-patcher.h:241:17: error: expected ';' before 'og_bwav_size'
241 | uint64_t og_bwav_size;
| ^~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:248:17: error: 'skipped_files' was not declared in this scope
248 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:257:25: error: expected ';' before 'i'
257 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:257:44: error: 'i' was not declared in this scope
257 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:263:17: error: expected ';' before 'mod_bwav_size'
263 | uint64_t mod_bwav_size;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:272:25: error: expected ';' before 'i'
272 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:272:44: error: 'i' was not declared in this scope
272 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:278:9: error: 'og_bwav_size' was not declared in this scope; did you mean 'og_bwav_data'?
278 | og_bwav_size = og_bwav.tellg();
| ^~~~~~~~~~~~
| og_bwav_data
../bars-patcher-core/bars-patcher.h:279:9: error: 'mod_bwav_size' was not declared in this scope; did you mean 'mod_bwav_data'?
279 | mod_bwav_size = mod_bwav.tellg();
| ^~~~~~~~~~~~~
| mod_bwav_data
../bars-patcher-core/bars-patcher.h:296:25: error: expected ';' before 'i'
296 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:296:44: error: 'i' was not declared in this scope
296 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:308:13: error: 'skipped_files' was not declared in this scope
308 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:313:13: error: 'skipped_files' was not declared in this scope
313 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:327:17: error: expected ';' before 'og_bwav_chnum'
327 | uint16_t og_bwav_chnum, mod_bwav_chnum;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:328:9: error: 'og_bwav_chnum' was not declared in this scope; did you mean 'og_bwav_bom'?
328 | og_bwav_chnum = barspatcher_getSliceAsNumber(slice_output, og_bwav_data, 0x0E, 2, og_bwav_bom);
| ^~~~~~~~~~~~~
| og_bwav_bom
../bars-patcher-core/bars-patcher.h:329:9: error: 'mod_bwav_chnum' was not declared in this scope; did you mean 'mod_bwav_bom'?
329 | mod_bwav_chnum = barspatcher_getSliceAsNumber(slice_output, mod_bwav_data, 0x0E, 2, mod_bwav_bom);
| ^~~~~~~~~~~~~~
| mod_bwav_bom
../bars-patcher-core/bars-patcher.h:333:13: error: 'skipped_files' was not declared in this scope
333 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:338:9: error: 'uint32_t' was not declared in this scope
338 | uint32_t og_bwav_crc32;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:338:9: note: 'uint32_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:339:9: error: 'uint8_t' was not declared in this scope
339 | uint8_t og_bwav_crc32_bytes[4];
| ^~~~~~~
../bars-patcher-core/bars-patcher.h:339:9: note: 'uint8_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:342:16: error: 'og_bwav_crc32_bytes' was not declared in this scope
342 | memcpy(og_bwav_crc32_bytes, slice_output, 4);
| ^~~~~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:343:9: error: 'og_bwav_crc32' was not declared in this scope; did you mean 'og_bwav_bom'?
343 | og_bwav_crc32 = barspatcher_getSliceAsNumber(slice_output, og_bwav_crc32_bytes, 0, 4, og_bwav_bom);
| ^~~~~~~~~~~~~
| og_bwav_bom
../bars-patcher-core/bars-patcher.h:346:17: error: expected ';' before 'patch_length'
346 | uint32_t patch_length = 0x10 + 0x4Cmod_bwav_chnum;
| ^~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:347:12: error: 'patch_length' was not declared in this scope
347 | if(patch_length > BARSPATCHER_MODBWAV_MEMBLOCK_SIZE) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:349:13: error: 'skipped_files' was not declared in this scope
349 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:357:17: error: expected ';' before 'patches_written'
357 | uint16_t patches_written = 0;
| ^~~~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:358:17: error: expected ';' before 'c'
358 | uint16_t c;
| ^~
| ;
../bars-patcher-core/bars-patcher.h:361:21: error: expected ';' before 'bars_pos'
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:361:34: error: 'bars_pos' was not declared in this scope
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:361:45: error: 'bars_size' was not declared in this scope
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:363:17: error: 'c' was not declared in this scope
363 | for(c = 0; c < 4; c++) {
| ^
../bars-patcher-core/bars-patcher.h:372:25: error: expected ';' before 'bars_bwav_offset'
372 | uint32_t bars_bwav_offset = bars_pos - 0x08;
| ^~~~~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:373:65: error: 'bars_bwav_offset' was not declared in this scope
373 | if(verbose) printf("Found at 0x%08X in BARS, ", bars_bwav_offset);
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:375:32: error: 'bars_bwav_offset' was not declared in this scope
375 | if(bars_size - bars_bwav_offset < patch_length) {
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:375:51: error: 'patch_length' was not declared in this scope
375 | if(bars_size - bars_bwav_offset < patch_length) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:381:29: error: expected ';' before 'i'
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^~
| ;
../bars-patcher-core/bars-patcher.h:381:35: error: 'i' was not declared in this scope
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^
../bars-patcher-core/bars-patcher.h:381:39: error: 'patch_length' was not declared in this scope
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:382:31: error: 'bars_bwav_offset' was not declared in this scope
382 | bars_data[bars_bwav_offset + i] = mod_bwav_data[i];
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:386:17: error: 'patches_written' was not declared in this scope
386 | patches_written++;
| ^~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:393:12: error: 'patches_written' was not declared in this scope
393 | if(patches_written > 0) patched_files++;
| ^~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:393:33: error: 'patched_files' was not declared in this scope
393 | if(patches_written > 0) patched_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:395:13: error: 'skipped_files' was not declared in this scope
395 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:400:8: error: 'patched_files' was not declared in this scope
400 | if(patched_files == 0) {
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:405:21: error: expected ';' before 'i'
405 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:405:40: error: 'i' was not declared in this scope
405 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:418:21: error: expected ';' before 'i'
418 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:418:40: error: 'i' was not declared in this scope
418 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:423:35: error: 'bars_size' was not declared in this scope
423 | ofile.write((char)bars_data, bars_size);
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:431:21: error: expected ';' before 'i'
431 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:431:40: error: 'i' was not declared in this scope
431 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:439:57: error: 'patched_files' was not declared in this scope
439 | printf("%d track%s patched, %d track%s skipped.\n", patched_files, (patched_files == 1 ? "" : "s"), skipped_files, (skipped_files == 1 ? "" : "s"));
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:439:105: error: 'skipped_files' was not declared in this scope
439 | printf("%d track%s patched, %d track%s skipped.\n", patched_files, (patched_files == 1 ? "" : "s"), skipped_files, (skipped_files == 1 ? "" : "s"));
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:443:17: error: expected ';' before 'i'
443 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:443:36: error: 'i' was not declared in this scope
443 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^`
Where am I going wrong?
Fixed in the latest commit, cstdint is now included. Update to the latest commit and try again.