User forums > General (but related to Code::Blocks)
Problems with graphics.h and winbgim.h; redefinition of 'int right'
WhoAmI:
Hello!
I am trying to do some simple graphic programs. But I can't build my project because I always get this error message:
--- Code: ---c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\graphics.h|302|error: redefinition of 'int right'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\graphics.h|302|error: 'int right' previously declared here|
||=== Build finished: 2 errors, 0 warnings ===|
--- End code ---
.
The same error occurs in winbgim.h. I am not sure if I posted this topic to the right forum, but anyway I don't know if is it really library problem or incorrect settings of my IDE.
I have downloaded files mentioned in subject from here: http://www.mediafire.com/?hokmzgomtje and did everything according to these instructions http://gagsays.wordpress.com/2010/04/27/bgi-graphics-for-windows-on-request/. I also tried download from here http://codecutter.org/tools/winbgim/, but the situation repeated.
Did anybody have the same problem? And does anybody haveany idea how to fix it?
I am using Code::Blocks 10.05 IDE, Windows XP Service pack 2.
stahta01:
Turn on Full Compiler Logging and post in a forum that supports your compiler or library.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
This site supports neither.
Tim S.
stahta01:
Note: The Codeblocks-EP in this thread has the winbgim in it.
You might wish to try it. I have not tried it.
http://forums.codeblocks.org/index.php/topic,15135.0.html
Tim S.
codeur:
WhoAmI,
The error message is caused by multiple compilations of graphics.h because you are using a poorly built version of WinBGIm without the standard protection in the headers.
You can protect winbgim.h and graphics.h by surrounding all the code with:
#ifndef WINBGI_H
#define WINBGI_H
.... The existing header code
#endif
OR (better suggestion):
Either
1- install CodeBlocks-EP and use the inbuilt WinBGIm (create a winbgim project in Codeblocks-EP).
or
2- download the correct library from http://winbgim.codecutter.org and install the correct library instead of yours.
- 1 is safer, WinBGIm works very well in Codeblocks-EP. The WinBGIm project will link the correct libraries, you get WinBGIm help in the help menus, etc...
- 2 will probably also work unless you use a very different version of MinGW.
WhoAmI:
Thank you for help. Although I have tried all your advices, none of them did work. I am really confused of it. Maybe I should look for some other libraries. Do you have any tip for simple 2D graphic?
Anyway, I thank you very much for your effort to help.
Navigation
[0] Message Index
[#] Next page
Go to full version