6 Replies - 2352 Views - Last Post: 28 June 2010 - 01:45 PM Rate Topic: -----

#1 CodingNewb  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 229
  • Joined: 04-December 09

GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 09:18 AM

Well I've looked around the internet, and it looks like Dev C++ isn't the only compiler with this problem. It seems to me that there's a problem with the compilers and 64-bit Windows. I'm running 7.

I just installed GTK and am testing it with the startup code. Everything compiled fine, but I get this.

Posted Image


Looking for solutions. Help?


EDIT: I used that image I found, it's the same problem with CB, ignore the window title.

This post has been edited by CodingNewb: 28 June 2010 - 09:19 AM


Is This A Good Question/Topic? 0
  • +

Replies To: GTK/Compiler Problem In Dev C++

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 09:35 AM

error code 7b corresponds to ERROR_INVALID_NAME, according to here.

Without code, what more do you expect from us?
Was This Post Helpful? 0
  • +
  • -

#3 CodingNewb  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 229
  • Joined: 04-December 09

Re: GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 09:44 AM

View PostJackOfAllTrades, on 28 June 2010 - 08:35 AM, said:

error code 7b corresponds to ERROR_INVALID_NAME, according to here.

Without code, what more do you expect from us?



Well, the code doesn't look like the problem to me, from what I've seen across the web, a variety of code is getting this error, causing me to assume a problem with the compiler. But here's my code anyways.


#include <stdlib.h>
#include <gtk/gtk.h>


static void helloWorld (GtkWidget *wid, GtkWidget *win)
{
  GtkWidget *dialog = NULL;

  dialog = gtk_message_dialog_new (GTK_WINDOW (win), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Hello World!");
  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
  gtk_dialog_run (GTK_DIALOG (dialog));
  gtk_widget_destroy (dialog);
}


int main (int argc, char *argv[])
{
  GtkWidget *button = NULL;
  GtkWidget *win = NULL;
  GtkWidget *vbox = NULL;

  /* Initialize GTK+ */
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
  gtk_init (&argc, &argv);
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);

  /* Create the main window */
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (win), 8);
  gtk_window_set_title (GTK_WINDOW (win), "Hello World");
  gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
  gtk_widget_realize (win);
  g_signal_connect (win, "destroy", gtk_main_quit, NULL);

  /* Create a vertical box with buttons */
  vbox = gtk_vbox_new (TRUE, 6);
  gtk_container_add (GTK_CONTAINER (win), vbox);

  button = gtk_button_new_from_stock (GTK_STOCK_DIALOG_INFO);
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (helloWorld), (gpointer) win);
  gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);

  button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
  g_signal_connect (button, "clicked", gtk_main_quit, NULL);
  gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);

  /* Enter the main loop */
  gtk_widget_show_all (win);
  gtk_main ();
  return 0;
}


Was This Post Helpful? 0
  • +
  • -

#4 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 09:50 AM

First, some terminology. Dev-C++ is not a compiler. It is an IDE. Same for Codeblocks.

If you are able to compile everything just fine, you don't have a compiler issue. After all, you are able to compile with it...If you are really paranoid, you can use the TDM-GCC distribution. Not only is it actually up to date with gcc releases, it seems to work fine on Windows 7 x64 from my testing.

Quote

Well, the code doesn't look like the problem to me, from what I've seen across the web, a variety of code is getting this error
Are you able to reproduce the error yourself, with code that should be correct? From what I've seen across the web, people write buggy code...

Quote

causing me to assume a problem with the compiler
Right, because it's not possible that the code is at fault ...?

Fire up the debugger and isolate the issue. There's quite a bit of missing error checking in your program. In fact, it's non existent. You make calls to functions like gtk_window_new, but you don't check for success. A combination of added error checking and walking through with a debugger, and you should be able to isolate the relevant lines that cause a problem.

It's genuinely possible that the compiler is involved in the problem. But you need to gather evidence that supports that conclusion. If you take code that has a problem, and just say, well it's the compiler's fault, we are going nowhere from this point.

This post has been edited by Oler1s: 28 June 2010 - 09:52 AM

Was This Post Helpful? 0
  • +
  • -

#5 CodingNewb  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 229
  • Joined: 04-December 09

Re: GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 10:04 AM

View PostOler1s, on 28 June 2010 - 08:50 AM, said:

First, some terminology. Dev-C++ is not a compiler. It is an IDE. Same for Codeblocks.

If you are able to compile everything just fine, you don't have a compiler issue. After all, you are able to compile with it...If you are really paranoid, you can use the TDM-GCC distribution. Not only is it actually up to date with gcc releases, it seems to work fine on Windows 7 x64 from my testing.

Quote

Well, the code doesn't look like the problem to me, from what I've seen across the web, a variety of code is getting this error
Are you able to reproduce the error yourself, with code that should be correct? From what I've seen across the web, people write buggy code...

Quote

causing me to assume a problem with the compiler
Right, because it's not possible that the code is at fault ...?

Fire up the debugger and isolate the issue. There's quite a bit of missing error checking in your program. In fact, it's non existent. You make calls to functions like gtk_window_new, but you don't check for success. A combination of added error checking and walking through with a debugger, and you should be able to isolate the relevant lines that cause a problem.

It's genuinely possible that the compiler is involved in the problem. But you need to gather evidence that supports that conclusion. If you take code that has a problem, and just say, well it's the compiler's fault, we are going nowhere from this point.


Yeah, I know Dev C++ is an IDE, but I didn't want to say there was something wrong with my IDE, because that didn't seem to make much sense.


And as to pretty much everything else, this is Dev C++'s startup GTK code. I haven't even learned GTK yet, I'm just setting it up. And I'd assume that Bloodshed would run checks on code before they used it as example code...

This post has been edited by CodingNewb: 28 June 2010 - 10:05 AM

Was This Post Helpful? 0
  • +
  • -

#6 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 11:20 AM

So let me rephrase the problem you are posting here.

Steps to reproduce: Using Dev-C++, install GTK+ Devpack. Create a new GTK+ project in Dev-C++. You should see project with existing code as posted above. Compile code and run program.

Expected: Succesfully running program, a window with a button on it.

Observed: Error message as follows: .... (I actually don't know what you precisely got. Was it similar to the image above, to the point that it complained with 0xc0...7b error code?

In any case, a number of things must happen correctly, and if any of those fails, you may get such a message.

- If your program depends on dlls, those dlls should be found. For example, if the GTK+ build is a shared library, in other words, it is built as a DLL, then Windows needs to be able to find that. Usually, one puts it in the same directory as the executable. If GTK was built as a static library, there is no DLL to worry about.
- The built library must be consistent with what your program demands. For example, if you build a debug version of your program, your may then depend on debug versions of the CRT. If the library depends on the runtime versions of the CRT, there may be a problem.
- Bitness matters. If you have a 64 bit program, and you depend on a 32 bit library, expect to see failure.
- And so on.

Debugging is made harder by that you installed a Devpak. What people do is build the libraries. A Devpak is someone's package. It's possible they screwed up in packaging. It's possible that they compiled certain versions of their library only, that your program is not compatible with.

It's also possible that the fault is in the code.

Quote

And I'd assume that Bloodshed would run checks on code before they used it as example code...
GTK+ isn't part of the IDE. It's third party. Also, that everything must match properly, and there's no way for Dev-C++ to ensure that.

Also, old and buggy. You won't get sympathy if you say, "I found a bug or problem in Dev-C++".

Any number of things can fail, and there's no way to point out the problem. It's frustrating enough sitting at the computer and being able to debug locally. Remotely through a forum, you can see how we can't offer much in the way of help.

The most I can say is rebuild dependencies and write a simpler program. Grab GTK+ yourself and build it for debug and release use.
Was This Post Helpful? 0
  • +
  • -

#7 Guest_CodingNewb*


Reputation:

Re: GTK/Compiler Problem In Dev C++

Posted 28 June 2010 - 01:45 PM

Well, what you said about bit-compatability sounds right. I'm not on MY computer right now, but I believe that the devpack must've been 32-bit and that's causing the problem. I'll go in and install CB and manually install GTK+ 64-bit again.


Thanks for the help Oler1s.
Was This Post Helpful? 0

Page 1 of 1