|
|
| Author |
Message |
|
|
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 12:19 am Post subject: GTK+ integration problem |
|
|
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: (Plaintext) | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
--------------------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: (Plaintext) | 1 2 3 4 5 6 7 8 9
|
#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. |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 427 Location: Portland, OR USA
|
Posted: Tue Mar 13, 2007 1:02 am Post subject: |
|
|
PACKAGE_PREFIX and it's friends are typically defined by the autotools (autoconf, automake, etc.)
What are you using to build? |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 1:15 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 376 Location: State College, Pennsylvania
|
Posted: Tue Mar 13, 2007 2:44 am Post subject: |
|
|
| 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+. |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 427 Location: Portland, OR USA
|
Posted: Tue Mar 13, 2007 4:07 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 9:38 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
hydra Familiar Face
Joined: 23 Jan 2007 Posts: 35
|
Posted: Tue Mar 13, 2007 10:25 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 11:31 am Post subject: |
|
|
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: (Plaintext) | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #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: (Plaintext) | 1 2 3 4 5
| #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: (Plaintext) | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| 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: (Plaintext) | 1 2 3 4 5 6 7 8 9
| 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: (Plaintext) | 1 2 3
| gchar *package_prefix = PACKAGE_PREFIX;
gchar *package_data_dir = PACKAGE_DATA_DIR;
gchar *package_locale_dir = PACKAGE_LOCALE_DIR; |
The error is:
| Code: (Plaintext) | 1 2
| c:\...\simple\interface\src\main.c(54) : error C2065: 'PACKAGE' : undeclared identifier
|
This is obvious due to the line 54:
| Code: (Plaintext) | 1
| pixmap_dir = g_build_filename (package_data_dir, PACKAGE, "pixmaps", NULL); |
I tried to declare PACKAGE as:
| Code: (Plaintext) | 1
| char *PACKAGE="" |
But then 78 errors pop up :(
I even tried the following (on recommendation of some friends):
| Code: (Plaintext) | 1 2 3
| gchar *package_prefix = "";
gchar *package_data_dir = "";
gchar *package_locale_dir = ""; |
But getting the same one error as above:
| Code: (Plaintext) | 1 2
| c:\...\simple\interface\src\main.c(54) : error C2065: 'PACKAGE' : undeclared identifier
|
Hope someone could help me solving this.
Many thanks. |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 427 Location: Portland, OR USA
|
Posted: Tue Mar 13, 2007 4:28 pm Post subject: |
|
|
Again, I don't work in Windows, but I would imagine you would want to specify them as constants...
| Code: (Plaintext) | 1 2 3 4 5 6 7 8
|
#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? |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 6:49 pm Post subject: |
|
|
Ok I did as you've said...but one error make surface.
The same one as before:
| Code: (Plaintext) | 1
| c:\...\interface\src\main.c(58) : error C2065: 'PACKAGE' : undeclared identifier |
So I tried again to declare PACKAGE as:
| Code: (Plaintext) | 1
| char *PACKAGE="" |
But unfortunately I'm getting those 78 errors :cry:
The first one being:
| Code: (Plaintext) | 1
| 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. |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 7:06 pm Post subject: |
|
|
Oops...I thought this info might be help.
There is a config.h file in folder msvc.
I am forwarding its contents below.
| Code: (Plaintext) | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
/* 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: (Plaintext) | 1 2 3 4 5
| #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 |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 376 Location: State College, Pennsylvania
|
Posted: Tue Mar 13, 2007 7:08 pm Post subject: |
|
|
Use:
| Code: (Plaintext) | 1 2 3
| #ifdef HAVE_CONFIG_H
# include <config.h>
#endif | |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 9:13 pm Post subject: |
|
|
Despite using...
| Code: (Plaintext) | 1 2 3
| #ifdef HAVE_CONFIG_H
# include <config.h>
#endif |
...still get the same problem (undeclared identifier PACKAGE).
Please help. |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 427 Location: Portland, OR USA
|
Posted: Tue Mar 13, 2007 9:52 pm Post subject: |
|
|
PACKAGE is a #define in config.h for your program. Are you sure you're including config.h properly?
Try putting:
| Code: (Plaintext) | 1
| #define PACKAGE "test" | at the top of the main file and see if that specific error is still present. |
|
| Back to top |
|
 |
flyjason Familiar Face
Joined: 04 Mar 2007 Posts: 19
|
Posted: Tue Mar 13, 2007 10:50 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
|