Hello, I'm looking out for this in the web but I cannot found anything about it. I compiled A project with mappyal.h and the compiler returns the next error:
||=== Build: Debug in RPG (compiler: GNU GCC Compiler) ===|
C:\Users\User\Desktop\RPG\mappyal.h|56|error: conflicting declaration 'typedef struct BLKSTR BLKSTR'|
C:\Users\User\Desktop\RPG\mappyal.h|56|note: previous declaration as 'typedef struct BLKSTR BLKSTR'|
C:\Users\User\Desktop\RPG\mappyal.h|66|error: conflicting declaration 'typedef struct ANISTR ANISTR'|
C:\Users\User\Desktop\RPG\mappyal.h|66|note: previous declaration as 'typedef struct ANISTR ANISTR'|
C:\Users\User\Desktop\RPG\main.cpp||In function 'int _mangled_main()':|
C:\Users\User\Desktop\RPG\main.cpp|46|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
||=== Build failed: 2 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
How it is? I didn't modify the code of the file and I followed all intructions to build mappyal.h. I'm using Codeblocks under Windows 10. :
Here I put the header file
NOTE: I'm starting programing in C/C++ and Allegro 4.2.2 ;RE
]]>Almost certainly you have included mappyal.h twice, either directly or indirectly. See https://en.wikipedia.org/wiki/Include_guard
Second issue, on line 46 I guess you have something like:
char* text = "some text";
Just change char* to const char*
]]>Well. I'll try this and return after that
Ok. I did it but the compiler now send me this errors:
||=== Build: Debug in RPG (compiler: GNU GCC Compiler) ===|
C:\Users\User\Desktop\RPG\room.cpp|3|multiple definition of `bgoff'|
obj\Debug\main.o:C:\Users\User\Desktop\RPG\main.cpp|38|first defined here|
C:\Users\User\Desktop\RPG\room.cpp|3|multiple definition of `fgoff'|
obj\Debug\main.o:C:\Users\User\Desktop\RPG\main.cpp|38|first defined here|
C:\Users\User\Desktop\RPG\room.cpp|3|multiple definition of `fgoff2'|
obj\Debug\main.o:C:\Users\User\Desktop\RPG\main.cpp|38|first defined here|
C:\Users\User\Desktop\RPG\room.cpp|7|multiple definition of `fgoff3'|
obj\Debug\main.o:C:\Users\User\Desktop\RPG\main.cpp|38|first defined here|
||error: ld returned 1 exit status|
||=== Build failed: 9 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
What is this error? I don't know why.
I followed the instructions to build the .o file and link it to my project (It is explained in the README.txt of Mappy) Should I rebuild it? What steps should I follow to link the mappyal under Codeblocks in Windows?
Thanks for the responses :RE
]]>It looks like you're linking more than once.
Either add mappyal.c to your project, or link it once at the end.
]]>Your main.cpp file includes "room.h" and "mappyal.h"
room.h already includes mappyal.h
You forgot to block duplication of header info
#ifndef MAPPYAL_H #define MAPPYAL_H ... #endif
]]>
Now I tryed to rebuild the project to clean all files wich are duplicated. As I can see, I have to upload the hole project to make the situation more understadable. I blocked the mappyal.h file but it doesn't result. Also I tryed to include into the project the mappyal.c but it gives me the same error.
NOTE: I'm working under Windows 10 and Codeblocks IDE MinGW with Allegro 4.2.2
Thanks for your answers!
]]>What is the error now?
One issue is that your struct definitions are not the same.
]]>
Thank you people. I solved the mistake including the mappyal.h file in room.cpp and doing the same for other libaries that were used in this way. Thanks you again.
]]>