LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-19-2008, 09:51 AM   #1
nano2
Member
 
Registered: May 2007
Posts: 100

Rep: Reputation: 15
gcc complains about files names been the same as dirname


Hi
Has anyone seen this where you have the same directory name as a the filename you want to compile
for eg /xname/xname.c /xname/xname/

Is there anyway I can get this to work using gcc ... Is there a flag I can use ?

When i try the to compile it says ~/xname/xname : Is a directory

Any suggestions much appreciated ... Note I don't want to change the layout as it works with other compiler ...

Cheers
 
Old 06-19-2008, 11:48 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
This worked for me:
gcc -Wall -g acc/acc.c -o acc/acc err.o

I did need to copy an include file to acc/. Does your directory exist? Did you leave out the "-o". Your question implies that you did.
 
Old 06-20-2008, 04:37 AM   #3
nano2
Member
 
Registered: May 2007
Posts: 100

Original Poster
Rep: Reputation: 15
No I have the -o option there
note inside the xname dir I have another dir callled xname and filename xname.c
This is the directory structure ...

~/xname> ls
>Makefile
xname.c
xname
~/xname/xname>Makefile

~/xname> gcc -o xname xname.c

/usr/bin/ld: cannot open output file xname: Is a directory
collect2: ld returned 1 exit status
*** Error code 1
 
Old 06-20-2008, 07:09 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
Quote:
~/xname> ls
>Makefile
xname.c
xname
~/xname/xname>Makefile

~/xname> gcc -o xname xname.c
You have a ~/xname/xname directory. So you have a name conflict in ~/xname. Just like the error message says.
 
Old 06-23-2008, 04:46 AM   #5
nano2
Member
 
Registered: May 2007
Posts: 100

Original Poster
Rep: Reputation: 15
Question

Hi jschiwal

Is there a ggc flag that can bypass this error - I know there is a name conflict and I don't want to change the names ...
So was hoping that there was agcc compiler flag to ignore this type of error ...

Thanks
 
Old 06-23-2008, 05:32 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
It is not a compiler fault, it is the filesystem behaviour which avoids that. You can't have two different objects with the same name inside the same dierctory. That's it. Either choose another name for the executable or rename the sub-directory.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
GCC 3.4.6 issue with namespaces names nano2 Linux - Software 1 03-19-2008 04:40 PM
Apache ./configure complains no gcc aquaboot Linux - Newbie 2 01-03-2006 06:35 AM
"perl Makefile.PL" complains about cc & gcc (self solved tip) Raptor Ramjet Slackware 2 09-13-2004 03:24 PM
SAMBA: display of share names is OK but files names are wrong superandrzej Linux - Software 5 02-02-2004 10:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:02 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration