LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   c++ simple example not compiling under Fedora (http://www.linuxquestions.org/questions/programming-9/c-simple-example-not-compiling-under-fedora-909767/)

mythcat 10-24-2011 04:49 AM

c++ simple example not compiling under Fedora
 
Hi i make simple C++ example.
This example is compiling with :
Code:

gcc test-gnome.c -o test-gnome `gnome-config --cflags --libs gnomeui`
...but i got errors with this command:
Code:

$ gcc test-gnome.c -o test-gnome -I /usr/include/gnome-1.0/ -L /usr/include/gnome-1.0/
In file included from test-gnome.c:6:0:
/usr/include/gnome-1.0/gnome.h:12:26: fatal error: gnomesupport.h: No such file or directory
compilation terminated.

I search and i not find the file gnomesupport.h
I use Fedora 15.
Can you tell what it is , or what is wrong.
Also I want use -I /usr/include/gnome-1.0/ , because it is in many distro...
Is true ?
If you have additional infos about how to compile same source code in many distro , please tell me.
Thank you . Regards.

jhwilliams 10-24-2011 04:53 AM

On Fedora 15, you need to install the gnome-libs-devel package, which provides gnomesupport.h.

TheIndependentAquarius 10-24-2011 07:09 AM

g++ rather than gcc

MTK358 10-24-2011 07:55 AM

Quote:

Originally Posted by Anisha Kaul (Post 4506445)
g++ rather than gcc

I thought that GNOME/GTK+ uses plain C.

TheIndependentAquarius 10-24-2011 09:11 AM

Mine was a generic statement telling him that C++ needs g++.
Quote:

Originally Posted by mythcat (Post 4506374)
c++ simple example not compiling under Fedora


kalleanka 10-24-2011 02:42 PM

test-gnome.c is a c file. I hope. If its c++ change the ending to .cpp.

And jhwilliams got the anwser to your problem. Install the dev file.

MTK358 10-24-2011 03:02 PM

Quote:

Originally Posted by Anisha Kaul (Post 4506556)
Mine was a generic statement telling him that C++ needs g++.

Ah, I didn't pay much attention to the topic, I just noticed that he's using "gcc", the source file name ends in ".c", and it's a GNOME program (and GNOME programs are written in C).

mythcat 10-25-2011 01:28 AM

I have already the dev libs .
As I say :
Code:

gcc test-gnome.c -o test-gnome `gnome-config --cflags --libs gnomeui`
working fine.
My issue is about the way of compiling ... because i need to make this with :
Code:

-I /usr/include/gnome-1.0/ -L /usr/include/gnome-1.0/
The big question is way the first compiling line code ( ...--cflags) working well without gnomesupport.h and secondary compiling need this file ?

NevemTeve 10-25-2011 02:38 AM

That's what 'gnome-config --cflags --libs gnomeui' does. Test it from command line:

Code:

gnome-config --cflags --libs gnomeui
Another (perhaps more modern) approach would be using pkg-config:

Code:

pkg-config --cflags --libs libgnomeui-2.0


All times are GMT -5. The time now is 11:42 AM.