RE: RES: [Dev-C++] Re: 10 quick questions
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <ech...@ne...> - 2002-04-08 16:00:43
|
"Daniel K. O." <dan...@ya...> wrote:
>Thanks Evan
>
>It solved the problems with missing headers.
>
>But I'm still having some problems:
>
>
> 2)) Look to this error:
> "144 callbacks.c
> warning: passing arg 2 of `create_dir_browser' discards qualifiers
>from
> pointer target type"
>
> Here is the code:
> ///
> /* Function prototype */
> 7: GtkWidget *create_dir_browser(gchar * title, gchar * current_path,
> GtkSelectionMode mode, void (*handler) (gchar *));
>
> 124: void on_dir_select29(gchar * dir);
>
> ...
>
> 141: GtkWidget *win;
> 142:
> 143: win = create_dir_browser(_("Select Directory"), g_get_home_dir(),
> 144: GTK_SELECTION_SINGLE, on_dir_select29);
> ///
>
> I get this error in many other points too. I have no idea of what to do
> (what does the "void (*handler) (gchar *)" mean?).
I would try casting the second argument to (gchar*):
win = create_dir_browser(_("Select Directory"), (gchar*)g_get_home_dir(),
GTK_SELECTION_SINGLE, on_dir_select29);
I believe this error occures because the appliction was orrginally written in C which is less strict with it's type checking than C++. A type cast is probobly all you need.
gtk is a C library orrignaly written on linux but later ported to acouple different OSes, it is roughly equvilant to the gui libs for widows except I think that those are written in C++.
"void (*handler) (gchar *)" means a function pointer to a function of taking a gchar* and returning void.
on_dir_select29 should be a function of this type.
Ex:
void my_handler(gchar* variable){
// do something
}
int main(){
void (*handler)(gchar*); // a function pointer
handler = my_handler; // initialize pointer note: a function name is treated as a pointer here - no need to dereference
handler(gchar_ptr_variable); // user pointer
}
I don't know why the linker errors are occuring, they might go away after the fixes above, if not I would need to see the code where the erors occure.
Evan
PS What kind of app are you porting?
>
>
>
>
>
>Well, commenting those lines, it compiles, but then I get linker errors:
>
>c:/projects/lopster/global.o: In function `user2_compare':
>//c/projects/lopster/src/global.c:5452: undefined reference to
>`inet_network'
>
>c:/projects/lopster/search.o: In function `search_fields_detach':
>//c/projects/lopster/src/search.c:2117: undefined reference to
>`gtk_window_reposition'
>
>
>
>
>My objects included:
>
>-lgtk.dll -lgdk-win32-2.0.dll -lgmodule-2.0.dll -lgobject-2.0.dll -lglib-2.0
>.dll -lwininet -lwsock32 -lgtk-win32-1.3.dll C:\Dev-C++\Lib\gtk.lib
>C:\Dev-C++\Lib\gtk-win32-1.3.lib -lc -lmswsock -lgtk-win32-2.0.dll
>C:\Dev-C++\Lib\gtk-win32-2.0.lib
>
>
>
>Again, thanks for any help.
>
>
>
>
>
>
>Daniel K. O.
>
>
>
>-----Mensagem original-----
>De: dev...@li...
>[mailto:dev...@li...]Em nome de Evan Hempel
><ech...@ne...>
>Enviada em: sexta-feira, 5 de abril de 2002 16:23
>Para: "Dev-Cpp-Users"
>Cc: "Daniel K. O."
>Assunto: [Dev-C++] Re: 10 quick questions
>
>
>It looks like you need gtk+ and pw32 (a posix emulation layer)
>
>You can find them at:
> Pw32:http://pw32.sourceforge.net/
> Gtk+:http://gtk.org (dev-c++ packages at
>http://www.bloodshed.net/dev/packages/gtk.html)
>
>I think that these 2 packages would remove most (all?) the errors. But, I
>haven't used either - just read some of their docs.
>
>Evan Hempel
>
>PS: I think that there also is a dev-c++ package for pw32
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
|