gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > gbfs - compiler error cannot convert `void*' to ...

#21171 - kayan - Tue May 25, 2004 7:53 am

I try to compile libgbfs using devkitavance and g++ and I have this error which I really don`t know how to fix it.

cannot convert `void*' to `const GBFS_ENTRY*' in assignment

this is the faulty line
Code:

here = bsearch(key, dirbase,n_entries,sizeof(GBFS_ENTRY),namecmp);



Thanks

#21177 - NoMis - Tue May 25, 2004 1:00 pm

Try an explicit cast.

Code:

  here = bsearch(key, dirbase,(GBFS_ENTRY*)n_entries,sizeof(GBFS_ENTRY),namecmp);

#21193 - tepples - Tue May 25, 2004 5:36 pm

GBFS is written in C, not C++. You need to compile it as C code, using the name libgbfs.c rather than libgbfs.C or libgbfs.cpp. (GCC treats uppercase .C as C++ rather than C.) Could I see the part of your build script (batch file or makefile) that compiles libgbfs.c?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#21369 - kayan - Fri May 28, 2004 5:38 am

I had a lot of problem with the compilers lately, I was porting my program from HAM to devkitadvance and rebuilding my library into c++.

Now I switch everything to devkitARM, and it working like a charm even GBFS.

Thanks