undefined reference to IIcon

6 posts / 0 new
Last post
jap
jap's picture
Offline
Last seen: 3 weeks 2 days ago
Joined: 2011-06-04 05:53
undefined reference to IIcon

Hello,
I'm trying to compile a C++ program which uses the icon library's PutIconTags () function. I've included

  1. #include <proto/icon.h>

and the function call looks like this:

  1. IIcon->PutIconTags ( NULL,
  2. pDrawerIcon,
  3. ICONPUTA_NotifyWorkbench, TRUE,
  4. ICONPUTA_PutDefaultType, WBDRAWER,
  5. 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

xenic
xenic's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-05-07 04:52
Re: undefined reference to IIcon

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.

X1000 - OS 4.1FE
jap
jap's picture
Offline
Last seen: 3 weeks 2 days ago
Joined: 2011-06-04 05:53
Re: undefined reference to IIcon

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.

xenic
xenic's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-05-07 04:52
Re: undefined reference to IIcon

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.

X1000 - OS 4.1FE
jap
jap's picture
Offline
Last seen: 3 weeks 2 days ago
Joined: 2011-06-04 05:53
Re: undefined reference to IIcon

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.

xenic
xenic's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-05-07 04:52
Re: undefined reference to IIcon

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.

X1000 - OS 4.1FE
Log in or register to post comments