Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can't include library to main file in GCC

Status
Not open for further replies.

contagiouseddie

Member level 2
Joined
May 10, 2004
Messages
51
Helped
8
Reputation
16
Reaction score
5
Trophy points
1,288
Activity points
490
I would like to include glib.h in my main file. But I could not link this file to my main file called test.c.

include <glib.h>

int main()
{
-
.
.
.
-
}

I even use the command gcc test.c -I/usr/include/glib-2.0

When I use using the GUI of KDevelop to compile, the same problem arises which says invalid file or directory (glib.h). Before creating the project I even added the include path. Help.... I'm new to Linux...

Thank you very much...
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
Including Library

If gcc can't find an include file, it normally says something like this:
test.c:3:18: glib.h: No such file or directory

Are you sure that /usr/include/glib-2.0/glib.h is a good readable file?
 

contagiouseddie

Member level 2
Joined
May 10, 2004
Messages
51
Helped
8
Reputation
16
Reaction score
5
Trophy points
1,288
Activity points
490
Re: Including Library

Yes, I got the message: test.c:3:18: glib.h: No such file or directory
I even look for it under the directory and the file is there. Even read it using 'cat' command. I don't quite get you on the 'good readable file' thing.
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
Including Library

The "invalid file or directory" message may have meant the file or path was somehow inaccessible or unreadable, but if you are now getting "no such file or directory", then the problem seems to be a simple directory path issue. You specified the full include path on the command line, so it should work. It works for me running GCC under Linux.

Just for giggles,
Try putting the full explicit path into your #include <...>
Try changing it to #include "..."
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top