LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2015, 02:33 PM   #1
sharky
Member
 
Registered: Oct 2002
Posts: 569

Rep: Reputation: 84
missing binary operator before token "("


Seeing this and similar errors when compiling.

Quote:
./iupgtk_webbrowser.c:254:22: error: missing binary operator before token "("
The line in that file is a preprocessor statement.

Code:
#if GTK_CHECK_VERSION(2, 10, 0)
I can modify that statement to clear the error.

Code:
#if GTK_CHECK_VERSION == (2, 10, 0)
However, I do not know if this is the intended functionality.

Hope the issue is stated clearly. Am open to any advice as I am not familiar with gcc and c programming.
 
Old 07-10-2015, 07:32 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
#1
What is the name of this unknown program ?
-- a link would help

#2
what version of gcc is being used ?
as in are you trying to build VERY old code with a VERY new compiler

a guess
this is a 3 year old and 3year out of date lua iup
and your version of gcc it way too new for 3 year old unsupported code
 
Old 07-11-2015, 07:18 AM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Did you do
Code:
#include <gtk/gtk.h>
 
Old 07-11-2015, 11:26 AM   #4
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by John VV View Post
#1
What is the name of this unknown program ?
-- a link would help

#2
what version of gcc is being used ?
as in are you trying to build VERY old code with a VERY new compiler

a guess
this is a 3 year old and 3year out of date lua iup
and your version of gcc it way too new for 3 year old unsupported code
Yes this is iup (http://www.kiatoa.com/fossils/iuplib) but it's complicated.

I actually started with a project called 'megatest'.

Code:
fossil clone http://www.kiatoa.com/cgi-bin/fossils/megatest megatest.fossil
mkdir megatest ; cd megatest
fossil open ../megatest.fossil
This downloads the megatest project and within that project is a utils subdirectory that has a Makefile. It is that makefile that I am attempting to run.

The make file has a step that uses fossil to clone and open iuplib, then another step that runs a script. The script runs three more makefiles and it is these makefiles that run gcc and generate the aforementioned errors.

It's like peeling an onion.

I do not know much about the code (or c in general) so yes it could be old. I am using gcc 4.8.4.

I appreciate your reply and welcome any other questions or suggestions you might have.
 
Old 07-11-2015, 11:29 AM   #5
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by smallpond View Post
Did you do
Code:
#include <gtk/gtk.h>
Yes. That line is in the code.

Thanks,
 
Old 07-11-2015, 11:55 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
https://developer.gnome.org/gtk3/sta...st-Macros.html
This GTK_CHECK_VERSION macro may not exist before version 3
 
Old 07-11-2015, 01:20 PM   #7
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by NevemTeve View Post
https://developer.gnome.org/gtk3/sta...st-Macros.html
This GTK_CHECK_VERSION macro may not exist before version 3
The compiler returns and error on any GTK_CHECK_VERSION statement regardless of major, minor, or micro numbers.
 
Old 07-13-2015, 02:06 AM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Well, this works for me:
Code:
$ tail Makefile
gtktest: CPPFLAGS += $(shell pkg-config --cflags gtk+-2.0)
gtktest: LIBS     += $(shell pkg-config --libs   gtk+-2.0)
Code:
$ cat gtktest.c
/* gtktest.c */

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

int main (void)
{
    printf (
	"compile: ver=%d.%d.%d\n"
	"runtime: ver=%d.%d.%d\n"
	, GTK_MAJOR_VERSION
	, GTK_MINOR_VERSION
	, GTK_MICRO_VERSION
	, gtk_major_version
	, gtk_minor_version
	, gtk_micro_version
	);

#if GTK_CHECK_VERSION(2,20,1)
    printf ("New enough\n");
#else
    printf ("Too old\n");
#endif

    return 0;
}
Conclusion: you didn't quote the very first compilation error message (which was about missing headers) instead picked one at random.
 
Old 07-13-2015, 09:30 AM   #9
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by NevemTeve View Post
Well, this works for me:
Code:
$ tail Makefile
gtktest: CPPFLAGS += $(shell pkg-config --cflags gtk+-2.0)
gtktest: LIBS     += $(shell pkg-config --libs   gtk+-2.0)
Code:
$ cat gtktest.c
/* gtktest.c */

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

int main (void)
{
    printf (
	"compile: ver=%d.%d.%d\n"
	"runtime: ver=%d.%d.%d\n"
	, GTK_MAJOR_VERSION
	, GTK_MINOR_VERSION
	, GTK_MICRO_VERSION
	, gtk_major_version
	, gtk_minor_version
	, gtk_micro_version
	);

#if GTK_CHECK_VERSION(2,20,1)
    printf ("New enough\n");
#else
    printf ("Too old\n");
#endif

    return 0;
}
Conclusion: you didn't quote the very first compilation error message (which was about missing headers) instead picked one at random.
There are no errors about missing headers. I had nine errors and they were all regarding 'missing binary operator'.

What does the rest of your makefile look like?
 
Old 07-13-2015, 11:28 AM   #10
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Here is a complete Makefile that worked for me with the previous example-program:

Code:
gtktest: CPPFLAGS += $(shell pkg-config --cflags gtk+-2.0)
gtktest: LIBS     += $(shell pkg-config --libs   gtk+-2.0)

%: %.c
	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ $^ ${LIBS}

Last edited by NevemTeve; 07-13-2015 at 11:36 AM.
 
Old 07-13-2015, 12:03 PM   #11
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by NevemTeve View Post
Here is a complete Makefile that worked for me with the previous example-program:

Code:
gtktest: CPPFLAGS += $(shell pkg-config --cflags gtk+-2.0)
gtktest: LIBS     += $(shell pkg-config --libs   gtk+-2.0)

%: %.c
	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ $^ ${LIBS}
That returned numerous errors on this end.

Partial return;
Quote:
Package gtk-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-2.0' found
Package gtk-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-2.0' found
cc -o gtktest gtktest.c
gtktest.c:4:21: error: gtk/gtk.h: No such file or directory
I do not have these errors trying to compile the iup code. However the return from make has several -I</some/include/path> options with gcc.

example:
Code:
gcc -c  -Wall -O2 -m64 -fPIC -I../include -I../src -I../src/gtk \
-I/usr/include/webkit-1.0 -I/usr/include/libsoup-2.4 -I/usr/include/webkitgtk-1.0 \
-I/usr/include/atk-1.0 -I/usr/include/gtk-2.0 -I/usr/include/gdk-pixbuf-2.0 \
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 \
-I/usr/lib64/glib-2.0/include -I/usr/lib64/gtk-2.0/include -I/usr/lib/glib-2.0/include \
-I/usr/lib/gtk-2.0/include -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \
-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include    -DTEC_UNAME=Linux30_64 \
-DTEC_SYSNAME=Linux -DLinux=3.0 -DTEC_LITTLEENDIAN -DTEC_64 -DFUNCPROTO=15 \
-DNDEBUG -o ../obj/iupweb/Linux30_64/iup_webbrowser.o iup_webbrowser.c
I tested that at work which forces me to use Suse Enterprise Server 11 version of linux. I will try again this evening on my Mint 17.1 home pc.

Thanks,
 
Old 07-13-2015, 12:10 PM   #12
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
You should have a libgtk+-2.0.pc file somewhere -- if not, your install might be incomplete

Code:
$ dpkg -S /usr/lib/pkgconfig/gtk+-2.0.pc 
libgtk2.0-dev: /usr/lib/pkgconfig/gtk+-2.0.pc

$ dpkg -l libgtk2.0-dev
+++-==============-==============-============================================
ii  libgtk2.0-dev  2.20.1-2       Development files for the GTK+ library
 
Old 07-13-2015, 05:55 PM   #13
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by NevemTeve View Post
You should have a libgtk+-2.0.pc file somewhere -- if not, your install might be incomplete

Code:
$ dpkg -S /usr/lib/pkgconfig/gtk+-2.0.pc 
libgtk2.0-dev: /usr/lib/pkgconfig/gtk+-2.0.pc

$ dpkg -l libgtk2.0-dev
+++-==============-==============-============================================
ii  libgtk2.0-dev  2.20.1-2       Development files for the GTK+ library
Reran your test at home on my personal PC and it compiled and ran with no issue.
 
Old 07-29-2015, 12:00 PM   #14
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Still have not solved this.

This is the first error I get.

Quote:
gcc -c -Wall -O2 -m64 -fPIC -I../include -I. -Igtk -I/usr/include/atk-1.0 -I/usr/include/gtk-3.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/X11R6/include -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DTEC_UNAME=Linux319_64 -DTEC_SYSNAME=Linux -DLinux=3.19 -DTEC_LITTLEENDIAN -DTEC_64 -DFUNCPROTO=15 -DNDEBUG -o ../obj/Linux319_64/iupgtk_dialog.o gtk/iupgtk_dialog.c
gtk/iupgtk_dialog.c: In function ‘gtkDialogUnMapMethod’:
gtk/iupgtk_dialog.c:587:3: error: unknown type name ‘GtkStatusIcon’
GtkStatusIcon* status_icon;
This is line 586 - 588 from gtk/iupgtk_dialog.c.

Code:
#if GTK_CHECK_VERSION(2, 10, 0)
  GtkStatusIcon* status_icon;
#endif
#include <gtk/gtk.h> is the first uncommented line in the file and 'dpkg -s libgtk2.0-dev' indicates that the package is installed.
 
Old 07-31-2015, 05:52 AM   #15
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
How about doing some research? You could find out where (in which header) is GtkStatusIcon is declared.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." davcefai Debian 1 02-15-2014 03:11 AM
Centos Server Failed @ Bootup: Missing "/sbin/blkid" & "fsck" command not found beagle7 Linux - Newbie 4 08-24-2012 01:33 AM
Binary "perl" is missing wierdly. (Section 6.7.1 LFS 6.5) guodah Linux From Scratch 16 10-12-2010 09:13 PM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration