I'm trying to compile a C++ program which uses the icon library's PutIconTags () function. I've included
- #include <proto/icon.h>
and the function call looks like this:
- IIcon->PutIconTags ( NULL,
- ICONPUTA_NotifyWorkbench, TRUE,
- ICONPUTA_PutDefaultType, WBDRAWER,
- TAG_DONE );
However, I get these errors:
error: 'ICONPUTA_NotifyWorkbench' was not declared in this scope
error: 'ICONPUTA_PutDefaultType' was not declared in this scope
If I comment the tags out, I get an IIcon error:
undefined reference to `IIcon'
What's wrong with my code? Do I need to include some additional system header files to make it work?
I'm compiling with these options: -O3 -N -Wall -lauto
Some of the OS4 SDK proto files don't include all the header files necessary to use some (or all) the functions in a library. Try adding "<#include workbench/icon.h>" to your program and see if that helps.
Thanks, it solved the tag problem.
The "undefined reference" problem remained but I solved it by opening the icon library myself. Apparently it's not opened automatically.
That's strange. I put your function call in a simple test sourcefile and it compiled with no errors using -lauto with gcc and c++. Maybe your libauto.a library doesn't contain IIcon but mine does.
I don't program with c++ but the c++ compile seemed unusually large. The filesize when compiled with gcc was about 7k and with c++ was about 250k.
The size of the libauto.a, which I have, is 250 674 bytes and the MD5Sum command gives this checksum for it: 574c55477051a19af591d186b94b71ba.
I noticed the large file size too. GCC creates huge executables from the C++ programs.
Your libauto.a is the same size and checksum as mine, so I can't explain why it would work for me and not for you. I'm glad to see you got it working by opening the library yourself though.