473,657 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C compilation error on RHEL3

Hi,

Myfile.c include a "Otherfile. h" and this file is under different
directory. When I compile Myfile.c, the compiler says "Otherfile. h: No
such file or directory" I include the path to "Otherfile. h" in PATH
environment variable. It still does not compile. Is there anything else
that I should do in this case? BTW, this linux (Red Hat linux) Thanks.

Apr 19 '06 #1
21 1644
thua...@hotmail .com wrote:
Hi,

Myfile.c include a "Otherfile. h" and this file is under different
directory. When I compile Myfile.c, the compiler says "Otherfile. h: No
such file or directory" I include the path to "Otherfile. h" in PATH
environment variable. It still does not compile. Is there anything else
that I should do in this case? BTW, this linux (Red Hat linux) Thanks.


The name of the include file is seached in an implementation defined
way, check your documentation for the details. Many implementations
allow you to specify the full pathname of the file or add directories
to be seached using a command-line option. For example, if you are
using gcc, check out the -I option.

Robert Gamble

Apr 19 '06 #2
th*****@hotmail .com wrote:

Myfile.c include a "Otherfile. h" and this file is under
different
directory. When I compile Myfile.c, the compiler says
"Otherfile.h : No
such file or directory" I include the path to "Otherfile. h" in
PATH
environment variable. It still does not compile. Is there
anything else
that I should do in this case?


Changing PATH will not do. Try:

#include "path/Otherfile.h"

Apr 19 '06 #3
th*****@hotmail .com wrote:
Myfile.c include a "Otherfile. h" and this file is under different
directory. When I compile Myfile.c, the compiler says "Otherfile. h: No
such file or directory" I include the path to "Otherfile. h" in PATH
environment variable. It still does not compile. Is there anything else
that I should do in this case? BTW, this linux (Red Hat linux) Thanks.

1. This query is not specific to ANSI C, and this group is quite strict
about off-topic posts. Check your system documentation.

2. If you checked your documentation you will find references to
something called the "include path". This is the key to your problem.
Apr 19 '06 #4
Vladimir S. Oka said:
th*****@hotmail .com wrote:

Myfile.c include a "Otherfile. h" and this file is under
different
directory. When I compile Myfile.c, the compiler says
"Otherfile. h: No
such file or directory" I include the path to "Otherfile. h" in
PATH
environment variable. It still does not compile. Is there
anything else
that I should do in this case?


Changing PATH will not do. Try:

#include "path/Otherfile.h"


Bad idea. Sorry, Vladimir, but that's a surefire way to make the code
non-portable.

Better: use the compiler's include path switch (e.g. in gcc it's -I) to
specify where to look for headers.

Better still: shove the headers in a place the compiler always looks in
anyway (e.g. /usr/local/include is common on Linux systems).
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Apr 19 '06 #5
th*****@hotmail .com wrote:
Hi,

Myfile.c include a "Otherfile. h" and this file is under different
directory. When I compile Myfile.c, the compiler says "Otherfile. h: No
such file or directory" I include the path to "Otherfile. h" in PATH
environment variable. It still does not compile. Is there anything
else that I should do in this case? BTW, this linux (Red Hat linux)

Most compilers have a method to set additional include paths. Check
your documentation, find a newsgroup or forum for your compiler, or
search the web for those words.

Brian
Apr 19 '06 #6
On 2006-04-19, Richard Heathfield <in*****@invali d.invalid> wrote:
Vladimir S. Oka said:
th*****@hotmail .com wrote:

Myfile.c include a "Otherfile. h" and this file is under
different
directory. When I compile Myfile.c, the compiler says
"Otherfile.h : No
such file or directory" I include the path to "Otherfile. h" in
PATH
environmen t variable. It still does not compile. Is there
anything else
that I should do in this case?
Changing PATH will not do. Try:

#include "path/Otherfile.h"


Bad idea. Sorry, Vladimir, but that's a surefire way to make the code
non-portable.


Why is it non-portable? The / will always work (even if the development
system uses a different directory separator), and so long as you stick
to relative paths (relative to the include directories for the build). I
always thought this should be all right.
[...]
Better still: shove the headers in a place the compiler always looks in
anyway (e.g. /usr/local/include is common on Linux systems).


<OT>

This might not be the best way to organize the headers in every case
though. It's a UNIX convention to put all the headers from all packages
in one place, all the executables from all packages in another place,
and all the libs in another. But on other systems things are organized
differently, for example the headers, executables and libs may all go
beneath different subdirectories for each package. On Windows for
example you see dirs called things like "C:\Program Files\My Favorite
Program\Include \" which is where the headers for "My Favorite Program"
go.

Also, thuang2 may not have write access to /usr/local/include.

</OT>
Apr 19 '06 #7
Ben C <sp******@spam. eggs> writes:
On 2006-04-19, Richard Heathfield <in*****@invali d.invalid> wrote:
Vladimir S. Oka said:
th*****@hotmail .com wrote:

Myfile.c include a "Otherfile. h" and this file is under
different
directory . When I compile Myfile.c, the compiler says
"Otherfile. h: No
such file or directory" I include the path to "Otherfile. h" in
PATH
environme nt variable. It still does not compile. Is there
anything else
that I should do in this case?

Changing PATH will not do. Try:

#include "path/Otherfile.h"


Bad idea. Sorry, Vladimir, but that's a surefire way to make the code
non-portable.


Why is it non-portable? The / will always work (even if the development
system uses a different directory separator), and so long as you stick
to relative paths (relative to the include directories for the build). I
always thought this should be all right.


What makes you think the / will always work? The standard makes no
such guarantee.

It happens to be interpreted as a directory delimiter on most modern
systems used for development (Unix-like systems, MS DOS and Windows),
and if you don't care about portability beyond such systems you can
use it. Things like "#include <sys/foobar.h>" are common on Unix-like
systems.

Otherwise, your best bet is to use just the name of the header file
and use some compiler-specific method to tell the compiler where to
look.
[...]
Better still: shove the headers in a place the compiler always looks in
anyway (e.g. /usr/local/include is common on Linux systems).


<OT>

This might not be the best way to organize the headers in every case
though. It's a UNIX convention to put all the headers from all packages
in one place, all the executables from all packages in another place,
and all the libs in another. But on other systems things are organized
differently, for example the headers, executables and libs may all go
beneath different subdirectories for each package. On Windows for
example you see dirs called things like "C:\Program Files\My Favorite
Program\Include \" which is where the headers for "My Favorite Program"
go.

Also, thuang2 may not have write access to /usr/local/include.

</OT>


Putting the headers for one particular project in a system-wide
directory is ok if and only if you want to make those headers
available system-wide. If they're local to one project, you probably
want to keep them in the directory (or directory tree) for that
project.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 20 '06 #8
Richard Heathfield opined:
Vladimir S. Oka said:
#include "path/Otherfile.h"


Bad idea. Sorry, Vladimir, but that's a surefire way to make the code
non-portable.


You are, of course, absolutely right.

<OT type="excuse">
I should have refrained from testing Usenet access from my PDA on c.l.c
(in the header of the offending post you'll find: "User-Agent:
Yanoff-/3.2 (Palm)"). I actually thought I cancelled the post, but pen
based input on a tiny screen got the better of me.
</OT>

Anyway, I won't do it again...

--
Peace was the way.
-- Kirk, "The City on the Edge of Forever", stardate unknown

<http://clc-wiki.net/wiki/Introduction_to _comp.lang.c>

Apr 20 '06 #9
On 2006-04-19, Keith Thompson <ks***@mib.or g> wrote:
Ben C <sp******@spam. eggs> writes:
On 2006-04-19, Richard Heathfield <in*****@invali d.invalid> wrote:
Vladimir S. Oka said:
[snip]
#include "path/Otherfile.h" Bad idea. Sorry, Vladimir, but that's a surefire way to make the code
non-portable.
Why is it non-portable? The / will always work (even if the development
system uses a different directory separator), and so long as you stick
to relative paths (relative to the include directories for the build). I
always thought this should be all right.
What makes you think the / will always work? The standard makes no
such guarantee.
I drew the wrong conclusion from the fact that it usually does work.
It happens to be interpreted as a directory delimiter on most modern
systems used for development (Unix-like systems, MS DOS and Windows),


MS DOS (and some versions of Windows?) use \ in the shell, but you can
often use either \ or / in your #include directives.

As you say, though, this isn't standard, it's just the particular
preprocessor doing you a favour.

Thanks for putting me right on this one.
Apr 20 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6698
by: zhengfish | last post by:
Hi,All, I try to install mysql-5.0.15 on RHEL3-U5. But It give me a error. MySQL-client-standard-5.0.15-0.rhel3.i386.rpm MySQL-devel-standard-5.0.15-0.rhel3.i386.rpm MySQL-server-standard-5.0.15-0.rhel3.i386.rpm MySQL-shared-standard-5.0.15-0.rhel3.i386.rpm MySQL-standard-debuginfo-5.0.15-0.rhel3.i386.rpm
2
1771
by: zeb nest | last post by:
Hello, I have some problem to launch db2setup (install procedure for db2v8fp3) under linux (redhat 9.0) : /home/root/db2v8/conpe/db2/linux/install/db2jinst: line 131: 4359 Erreur de segmentation $JAVA_PATH/$JAVA_INTERPRETER $JAVA_OPTIONS -cp $JAVA_CLASSPATH $DB2SetupRun "$@" 2>/tmp/db2setup.err.running an idea to help me ? Thanks
10
2348
by: Sune | last post by:
Hi, previously I used Eclipse CDT for compiling my files just to get started with C and leave C++ behind. Now it's time to get a little more serious so I've moved my files to a new workplace and begun to use GNU Autotools. I'm sorry to say I'm new to gcc as well :( Now I get the most ridiculous compile error which I'm unable to solve. Can someone, please, help me with this? gcc output together with the files mentioned in the gcc error...
3
3342
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\1f575646\ad3a161b\assembly\dl2\57ca505e\044565c0_f84fc401\Test1.DLL' The problem is that the control is defined in two different assemblies
6
2886
by: Plat | last post by:
I've Googled this for a while, to no avail. Hopefully someone can help me. Maybe I'm using the wrong terminology. Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax error. For example, broken.aspx might only contain the following line of code: <% Dim x as %> When I visit this page from my Web browser, I see all the helpful ASP.NET Server Error information, including:
0
1041
by: Devrim GUNDUZ | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I've built PostgreSQL 7.4.3 RPMS on RHEL3. Needed to change the spec file a bit for tcl and kerberos. They heve been tested and are working fine. RPMS, SRPMS and SPEC file is located at:
2
1545
by: javier wilson | last post by:
i just build the rpm for rhel3 based on postgresql-7.4.3-3PGDG.src.rpm but i did not get the postgresql-tcl package. i looked for it in some mirrors like ftp://ftp22.us.postgresql.org/mirrors/www.postgresql.org/binary/v7.4.3/redhat/rhel3/ but apparently it is not included in the RPM version of postgresql 7.4.3 is this true? or it requires a development package i
2
3481
by: thuang2 | last post by:
Hi, How can I add more include path to gcc compiler on RHEL3? When re-compile C source code, do I have to do a "touch" command (by typing "touch myfile.c") before running "make" command? Thanks.
1
1661
JohanK
by: JohanK | last post by:
Hi there, I really need some help setting up mySQL. I'm running redhat enteprise linux 3.1 and the following rpm's are installed, mysql-3.23.58-16.RHEL3.1 libdbi-dbd-mysql-0.6.5-5 mysql-devel-3.23.58-16.RHEL3.1 Now my problem is that every time I try to connect to mysql I get the following error: ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.