Help with GCC?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
KieranFoot

Help with GCC?

Post by KieranFoot »

When I try to compile c code in gcc it comes up with an error, something like, Unrecognised command '-lang-c'

What does this mean & how can I rectify it?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Help with GCC?

Post by Candy »

KieranFoot wrote: When I try to compile c code in gcc it comes up with an error, something like, Unrecognised command '-lang-c'

What does this mean & how can I rectify it?
How do you compile? What C code? What version is gcc? How did you get that gcc, and how was it configured?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Help with GCC?

Post by Pype.Clicker »

there's nothing like "-lang-c" in parameters for GCC ... you're probably screwing up the building process or trying to pass parameters targetted at compiler X to compiler Y.

Could you provide a bit more information at *what* you're trying to compile and *what* you're trying to use ?

(e.g. attach your makefile or tell us the command you typed)
KieranFoot

Re:Help with GCC?

Post by KieranFoot »

I Typed:-

Gcc -c Myfile.C Myfile.???
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Help with GCC?

Post by Pype.Clicker »

now, *that*'s funny :P

- what does gcc --version returns ?
- does it work better if the file is named "myfile.c" (with a lower-case c as extension) than "myfile.C" ?
- what is the "myfile.???" argument you give after the filename ? You know "-c" flag tells the compiler "i just want you to compile this file into a relocatable, linkable object. Don't worry if there are unresolved dependencies, or missing libraries or whatever"

and once again, what's your dev. environment ? linux ? djgpp ? cygwin ? ...
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Help with GCC?

Post by Solar »

OK, let's see. Since you haven't told us anything about the contents of Myfile.C, I'll assume:

Code: Select all

int main()
{
    return 42;
}
When *I* type "Gcc -c Myfile.C Myfile.???", I get "Gcc: Myfile.???: No such file or directory.", so you probably did type something else.

Insufficient Information - Unable to reproduce.
Try again.

READY.
*blinking cursor*
Every good solution is obvious once you've found it.
sdfgb

Re:Help with GCC?

Post by sdfgb »

- gcc --help
Usage: gcc [options] file...
Options:
--help Display this information
(Use '-v --help' to display command line options of sub-processes)
<pype>... stuff omitted for compactness ...</pype>
-x <language> Specify the language of the following input files
Permissable languages include: c c++ assembler none
'none' means revert to the default behaviour of
guessing the language based on the file's extension
<pype>... stuff omitted for compactness ...</pype>

- gcc -v --help | & grep -i lang
/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.4/2.95.3/cpp0 -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(bsd) -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) --help help-dummy /usr/tmp/ccCVDdfB.i
-lang-c Assume that the input sources are in C
-lang-c89 Assume that the input is C89; depricated
-lang-c++ Assume that the input sources are in C++
-lang-objc Assume that the input sources are in ObjectiveC
-lang-objc++ Assume that the input sources are in ObjectiveC++
-lang-asm Assume that the input sources are in assembler
-lang-chill Assume that the input sources are in Chill
<pype>... stuff omitted for compactness ...</pype>
-


haven't you learned copy-paste in school ??
BI lazy

Re:Help with GCC?

Post by BI lazy »

@sdfgb: And what is the point of this all? What do you mean, besides intending to provoke.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Help with GCC?

Post by Solar »

For one, he's pointing out that KieranFoot could have gotten online help quite easy.

Second, he's pointing out that there *is* a -lang-c option to GCC.

Third, that still doesn't help since KieranFoot is a bit vague on what his problem is. ;-)
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Help with GCC?

Post by Pype.Clicker »

@bilazy: i guess the "code poet" (recognize him ? random-5-letters guest) is trying to say that i'm stupid because there *is* -c-lang option flag in his copy of GCC and that simply using "gcc -v --help" would have told me.

@code poet: i learnt *not* to copy/paste at school, for copy/pasting is the root of evil bugz.

Code: Select all

users/martin> gcc -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.3/specs
Configured with: (....)
Thread model: posix
gcc version 3.3 20030226 (prerelease) (SuSE Linux)
users/martin> gcc -c-lang
gcc: unrecognized option `-c-lang'
gcc: no input files
and

Code: Select all

users/martin> /opt/gnu/bin/gcc -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.3/specs
gcc version 2.95.3 20010315 (SuSE)
users/martin> /opt/gnu/bin/gcc -c-lang
gcc: unrecognized option `-c-lang'
gcc: No input files
So it seems "-lang-<language>" is not *that* widely available ...

@codepoet: would you mind becoming a member, one day, so that we don't have the feeling we talk to a wall but instead to a person ? or maybe you're just a program, in which case you should receive my apologize and upgrade to the latest available version of yourself.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Help with GCC?

Post by distantvoices »

@solar: maybe maybe, He's due respect for holding out the holy grail for old KieranFoot, but mark your third point which amongst three is the one which weighs most. ;-)

@pype: Of course a moment of recoginition is present - despite the lack of lyra in his lenghty post. That poet could have expressed this with less words without spoiling database space. :-) No need for apology. He's of course due to an update, I think. *rofl*

Maybe someone already has invented a brain flasher. :-)
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Help with GCC?

Post by Solar »

Erm... Pype? You are aware that the option is "-lang-c", not "-c-lang" as in your posting?
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Help with GCC?

Post by Pype.Clicker »

<doh>
My mind is temporarily absent ... /dev/brain is screening your call ... please talk after the beep ...

CTRL+H
</doh>

Well, according to `info gcc`,
(...) If cpp does not recognize the extension, it will treat the file as C; this is the most generic mode.

*Note:* Previous versions of cpp accepted a `-lang' option which
selected both the language and the standards conformance level.
This option has been removed, because it conflicts with the `-l'
option.
So i guess my typo isn't that troublesome :P
Dragon88

Re:Help with GCC?

Post by Dragon88 »

Solar wrote: OK, let's see. Since you haven't told us anything about the contents of Myfile.C, I'll assume:

Code: Select all

int main()
{
    return 42;
}
When *I* type "Gcc -c Myfile.C Myfile.???", I get "Gcc: Myfile.???: No such file or directory.", so you probably did type something else.

Insufficient Information - Unable to reproduce.
Try again.

READY.
*blinking cursor*
You're forgetting the -o option. What he wants is for gcc to compile and asseble myfile.C, and spit out myfile.???, but he's forgetting -o.

The correct way of doing that is:

gcc -c myfile.C -o myfile.???

As far as the no -lang-c option, I don't see that specified anyways. It probably stems from an old version of GCC.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Help with GCC?

Post by Pype.Clicker »

in every shell i know, 'myfile.???' is a wildcard name saying "myfile. followed by any three character". I'd say the make/batch file he's using is obsolete.
Post Reply