GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 24, 2014 1:02 pm

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: GTK+ integration problem
PostPosted: Tue Mar 13, 2007 12:19 am 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
Hi,

As you may have seen in one of my previous post, I'm working with a software library known as ARToolKit.

I am building a front-end GUI interface using GTK+. Of course, this interface will help interaction with ARToolKit.

However, while trying to link/integrate GTK+ with ARToolKit, I'm getting some undesired errors. ARToolKit is also in "C" so normally, this integration should have been fine.

The errors are related to main.c:
Code:
--------------------Configuration: simpleTest - Win32 Debug--------------------
Compiling...
callbacks.c
interface.c
main.c
c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(17) : error C2065: 'PACKAGE_PREFIX' : undeclared identifier

c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(17) : error C2099: initializer is not a constant

c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(18) : error C2065: 'PACKAGE_DATA_DIR' : undeclared identifier

c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(18) : error C2099: initializer is not a constant

c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(19) : error C2065: 'PACKAGE_LOCALE_DIR' : undeclared identifier

c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(19) : error C2099: initializer is not a constant

c:\...\artoolkit 2.71.2\examples\simple\interface\src\main.c(54) : error C2065: 'PACKAGE' : undeclared identifier
support.c
Generating Code...
Error executing cl.exe.

simpleTestd.exe - 7 error(s), 0 warning(s)


Below is part of main.c that is responsible for the errors.
Code:
#ifdef G_OS_WIN32

gchar *package_prefix = PACKAGE_PREFIX;
gchar *package_data_dir = PACKAGE_DATA_DIR;
gchar *package_locale_dir = PACKAGE_LOCALE_DIR;

#endif


I desperately hope that somebody can help...I really need to integrate that with ARToolKit.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 1:02 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
PACKAGE_PREFIX and it's friends are typically defined by the autotools (autoconf, automake, etc.)

What are you using to build?

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 1:15 am 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
Quote:
PACKAGE_PREFIX and it's friends are typically defined by the autotools (autoconf, automake, etc.)


Can't understand this part, can you be more clearer please?

I am using MS Visual C++ as working environment.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 2:44 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
If you would use autotools to manage the project, a file called config.h would be created. This file contains the defines you are looking for. Since you are using Visual Studio, I am not quite sure how those are defined. I would recommend that you check out the documentation for the compiler as well as the docs for the Win32 port of GTK+.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 4:07 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Here's an exert from a mailing list question...

Quote:
Sometime reading docs may help; from glib/README.win32 :

'''
Special Files
=============
config.h.win32.in : @XXX_MAJOR_VERSION@ needs to be replaced by
the current version/build number. The resulting file is to be saved
as 'config.h.win32'. This should be automatically done if a package
gets build on the Unix platform.


I've never worked with GTK+ on Windows. I'm assuming you've installed GTK+ and libraries according to some document or from an installer? If so, which one and from where?

Did you read through this? http://www.hitl.washington.edu/artoolkit/documentation/usersetup.htm#comp_windows

Basically, it seems you don't have the appropriate config.h file... so that's what you're looking for.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 9:38 am 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
I installed Gtk+/Win32 Development Environment (runtime, devel, docs, glade, etc.) Installer 2.10.7-1 (.exe, 11.88M)

As you can see it is complete (runtime, devel, docs, glade, etc). So I guess all the files and libraries are in here.

Do you mean that I should get the right config.h. So where can I get this?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 10:25 am 
Offline
Familiar Face

Joined: Tue Jan 23, 2007 6:13 pm
Posts: 34
I have this problem too... just remove the lines. :roll:
This package paths and dirs are useless on Windoze.
Could you explain how exactly you make the compiling?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 11:31 am 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
Ok as you know I work in the MS Visual C++ environment.

I'm working with a folder named simple inside ARToolKit. All the files related to GTK+ and Glade are in a folder name as Interface. This Interface folder contains the primary folders msvc, src and more. In folder msvc there is a config.h file. In folder src there is callbacks.c, main.c, interface.c, support.c and so on.

In my main program (i.e. in folder simple) known as simpleTest.c, I am making a call so that an interface window can appear.

Below is an extract of simpleTest.c (showing the differents headers involved).

Code:
#ifdef _WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifndef __APPLE__
#include <GL/gl.h>
#include <GL/glut.h>
#else
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#endif
#include <AR/gsub.h>
#include <AR/video.h>
#include <AR/param.h>
#include <AR/ar.h>

#include <gtk/gtk.h>
#include "interface/src/callbacks.h"
#include "interface/src/support.h"
#include "interface/src/interface.h"


As you've noticed I added the part:

Code:
#include <gtk/gtk.h>
#include "interface/src/callbacks.h"
#include "interface/src/support.h"
#include "interface/src/interface.h"


Since, there is a main block in simpleTest.c, I had to modify main.c (in src folder) so that it has no main block. I just did it like that:

Code:
int
mainn (int argc, char *argv[])
{
  ............
/* main changed to mainn */
  ............
  GtkWidget *win_main;
  ........................................
  ........................................
  win_main = create_win_main ();
  gtk_widget_show (win_main);
  g_signal_connect ((gpointer) win_main, "destroy", G_CALLBACK(gtk_main_quit),
                    NULL);
}

#ifdef _MSC_VER
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
  return mainn (__argc, __argv);
}
#endif


Ok, now in the main block of simpleTest.c, I am trying to call win_main. Don't know if it's the right way, but it does compile well.

Code:
int main(int argc, char **argv)
{

   GtkWidget *win_main;
   win_main = create_win_main ();
   gtk_widget_show (win_main);
        ...............................
        ...............................
}



Ok now I think you understand my problem better.

I tried to comment the following lines in main.c, but getting one error when compiling.

Code:
gchar *package_prefix = PACKAGE_PREFIX;
gchar *package_data_dir = PACKAGE_DATA_DIR;
gchar *package_locale_dir = PACKAGE_LOCALE_DIR;


The error is:
Code:
c:\...\simple\interface\src\main.c(54) : error C2065: 'PACKAGE' : undeclared identifier


This is obvious due to the line 54:
Code:
pixmap_dir = g_build_filename (package_data_dir, PACKAGE, "pixmaps", NULL);


I tried to declare PACKAGE as:
Code:
char *PACKAGE=""

But then 78 errors pop up :(

I even tried the following (on recommendation of some friends):
Code:
gchar *package_prefix = "";
gchar *package_data_dir = "";
gchar *package_locale_dir = "";


But getting the same one error as above:
Code:
c:\...\simple\interface\src\main.c(54) : error C2065: 'PACKAGE' : undeclared identifier


Hope someone could help me solving this.
Many thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 4:28 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Again, I don't work in Windows, but I would imagine you would want to specify them as constants...

Code:
#define PACKAGE_PREFIX "C:/Program Files"
#define PACKAGE_DATA_DIR "C:/Windows/Application Data"
#define PACKAGE_DATA_DIR "C:/Windows/Application Data"

gchar *package_prefix = PACKAGE_PREFIX;
gchar *package_data_dir = PACKAGE_DATA_DIR;
gchar *package_locale_dir = PACKAGE_LOCALE_DIR;


I don't know if those are the right paths or how any of that works on Windows but... you should look into that. I'm assuming that ARToolkit thing is using them somehow?

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 6:49 pm 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
Ok I did as you've said...but one error make surface.

The same one as before:

Code:
c:\...\interface\src\main.c(58) : error C2065: 'PACKAGE' : undeclared identifier


So I tried again to declare PACKAGE as:
Code:
char *PACKAGE=""


But unfortunately I'm getting those 78 errors :cry:

The first one being:
Code:
callbacks.obj : error LNK2001: unresolved external symbol _gtk_widget_show


Do you have any idea about that??

Quote:
#define PACKAGE_PREFIX "C:/Program Files"
#define PACKAGE_DATA_DIR "C:/Windows/Application Data"
#define PACKAGE_DATA_DIR "C:/Windows/Application Data"


Can you please tell me what you are trying to do here so that I can manipulate that? I mean what path are you actually looking for...the GTK+ directory (i.e. where it has been installed)?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 7:06 pm 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
Oops...I thought this info might be help.

There is a config.h file in folder msvc.

I am forwarding its contents below.
Code:
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1

/* Gettext package. */
#define GETTEXT_PACKAGE "interface"

/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#define HAVE_BIND_TEXTDOMAIN_CODESET 1

/* Define to 1 if you have the `dcgettext' function. */
#define HAVE_DCGETTEXT 1

/* Define if the GNU gettext() function is already present or preinstalled. */
#define HAVE_GETTEXT 1

/* Define if your <locale.h> file defines LC_MESSAGES. */
/* #undef HAVE_LC_MESSAGES */

/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Name of package */
#define PACKAGE "interface"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""

/* Define to the full name of this package. */
#define PACKAGE_NAME ""

/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""

/* Define to the version of this package. */
#define PACKAGE_VERSION ""

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Version number of package */
#define VERSION "0.1"


So as you can see PACKAGE has been defined here, as #define PACKAGE "interface".

I included the config.h file in simpleTest.c as shown below.
Code:
#include <gtk/gtk.h>
#include "interface/src/callbacks.h"
#include "interface/src/support.h"
#include "interface/src/interface.h"
#include "interface/msvc/config.h"


But still I'm having the same error...i.e. undeclared identifier!! Can't understand why because I adjusted the header files accordingly in simpleTest.c.


Last edited by flyjason on Tue Mar 13, 2007 7:16 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 7:08 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Use:

Code:
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 9:13 pm 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
Despite using...

Code:
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif


...still get the same problem (undeclared identifier PACKAGE).

Please help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 9:52 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
PACKAGE is a #define in config.h for your program. Are you sure you're including config.h properly?

Try putting:

Code:
#define PACKAGE "test"
at the top of the main file and see if that specific error is still present.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 10:50 pm 
Offline
Familiar Face

Joined: Sun Mar 04, 2007 8:25 pm
Posts: 19
When doing that I obtain back the 78 errors unfortunately :(

One bizarre thing is that if I run the GTK+ interface alone, it works. That is with no connection to ARToolKit. Thus, it compiles and builds fine. But as you know I should integrate it with ARToolKit. Bearing in mind that both are in C, they should normally blend finely... :roll:

What do you think should I do next?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group