Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » ImageFile (iml) #include [SOLVED]
Re: ImageFile [message #18972 is a reply to message #18967] |
Sun, 02 November 2008 21:46 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
sapiency wrote on Sun, 02 November 2008 14:14 | Hi Mirek,
thanks for you answer, I'm still a little bit confused , but I think I solved the problem ...
I have following files:
image-header.h (with #ifndef)
image-source.h (with #ifndef)
code_1.h (with #ifndef)
code_2.h (with #ifndef)
code_1.cpp
code_2.cpp
this works:
code_1.h includes image-header.h
code_1.cpp includes code_1.h, image-source.h
code_1.cpp use images
code_2.h includes code_1.h
code_2.cpp includes code_2.h
code_2.cpp use images
whenever I include image-source.h too in code_2.cpp, I get following message from the linker:
C:/upp/out/path/MINGW.Debug.Debug_full.Gui.Main.Mt\devicetree.o: In function `_ZN11OL_Controls3ImlEv':
C:/upp/uppsrc/Draw/iml_source.h:33: multiple definition of `OL_Controls::Iml()'
C:/upp/out/path/MINGW.Debug.Debug_full.Gui.Main.Mt\$blitz.o:C:/upp/uppsrc/Draw/iml_source.h:33: first defined here
object-file: devicetree -> code_2
regards
reinhard
|
Ehm, I am totally confused by number of your headers In any case, the error is because there is more that one .cpp file that directly or indirectly includes
#define IMAGECLASS NAME
#define IMAGEFILE <pathtofile/images.iml>
#include <Draw/iml_source.h>
Usually, and I would recommend that, when developing U++ app, we are using single "main" header per package and all C++ files include this one.
In that case, put those .iml lines with "iml_header.h" to this header and "iml_source.h" to any single .cpp.
Anyway, what you have done works too, of course. All you need to remember is that "iml_source.h" include is equivalent of defining all iml elements. And there is "one definition rule" in C++ - no function or variable can be defined twice (or linker error).
Just one more note - if you are doing things wrongly, it sometimes might lead to weird problems when you compile in debug mode (it compiles sometimes, sometimes not). This is caused by BLITZ compile accelerator, which sometimes hides wrong arrangement of headers.
Mirek
Mirek
|
|
|
Goto Forum:
Current Time: Thu May 16 00:39:33 CEST 2024
Total time taken to generate the page: 0.01274 seconds
|