Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Moj gcc ima shizofreniju: ne vidi sin, cos...

[es] :: C/C++ programiranje :: Moj gcc ima shizofreniju: ne vidi sin, cos...

[ Pregleda: 3643 | Odgovora: 14 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Predrag Damnjanovic
Predrag Damnjanovic
Nis, Srbija

Član broj: 141
Poruke: 1305
*.bankerinter.net

Sajt: www.mycity.rs


+1 Profil

icon Moj gcc ima shizofreniju: ne vidi sin, cos...02.10.2002. u 17:46 - pre 262 meseci
Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char *argv[])
{
        float f=cos(1.23);
}


# gcc test.c -o test
/tmp/ccVGgwAM.o: In function `main':
/tmp/ccVGgwAM.o(.text+0x16): undefined reference to `cos'
collect2: ld returned 1 exit status

???
Da odmah uklonim sumnju da je math.h na bilo koji nacin ostecen, nije uopste menjan.
Distribucija je slack 8.1
 
Odgovor na temu

Predrag Damnjanovic
Predrag Damnjanovic
Nis, Srbija

Član broj: 141
Poruke: 1305
*.bankerinter.net

Sajt: www.mycity.rs


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...02.10.2002. u 18:17 - pre 262 meseci
Hmmm...
Od kad treba da se doda -lm pri kompajliranju?
Sad radi.
 
Odgovor na temu

Dragoslav Krunić

Član broj: 225
Poruke: 1083
*.verat.net



Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...02.10.2002. u 18:32 - pre 262 meseci
Koliko ja znam oduvek se dodavalo,...
 
Odgovor na temu

Predrag Damnjanovic
Predrag Damnjanovic
Nis, Srbija

Član broj: 141
Poruke: 1305
*.bankerinter.net

Sajt: www.mycity.rs


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...02.10.2002. u 19:45 - pre 262 meseci
Pod RH nikad.
Evo bas cu uskoro da probam na RH 8.0.
Ili je ovo kod RH-a nesto namesteno, ili Slack koristi noviji gcc.
 
Odgovor na temu

Dragi Tata
Malo ispod Kanade

Član broj: 1958
Poruke: 3906
199.171.112.*



+6 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...02.10.2002. u 20:00 - pre 262 meseci
Hmmm, ja sam imao isti problem kao ti 1994 sa cc-om koji je išao uz HP-UX 7.0. Nije to ništa novo...
 
Odgovor na temu

alex
Aleksandar Radulovic
Senior Software Engineer, Spotify
Stockholm, Sweden

Član broj: 71
Poruke: 2194
*.du.heimsnet.is

Jabber: alex@a13x.info
ICQ: -1
Sajt: www.a13x.info


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...02.10.2002. u 23:23 - pre 262 meseci
Nema nikakve veze sa distribucijom niti sa verzijom unix-a, libm.so (libm.a) nikad nije po default-u linkovan, bar kad je o gcc-u rec.
Alex: My favorite site is http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x
 
Odgovor na temu

Predrag Damnjanovic
Predrag Damnjanovic
Nis, Srbija

Član broj: 141
Poruke: 1305
*.bankerinter.net

Sajt: www.mycity.rs


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 12:18 - pre 262 meseci
Alex, hoces da se kladimo da na je na RH-u linkovan po defaultu? :)
Nemam trenutno RH, ali dobro znam o cemu pricam.
Engine sam razvijao na njemu, koristi cos i sin, i dobro znam kako sam ga kompajlirao.
 
Odgovor na temu

Dragan
Dragan Gajic
Software Architect
Novi Sad

Član broj: 1596
Poruke: 76
*.nspoint.net



+15 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 13:37 - pre 262 meseci
Alex, kladi se! :)
Kod mene RH 7.2 i mora -lm...
"The most likely way for the world to be destroyed, most experts agree, is by
accident. That's where we come in; we're computer professionals. We cause
accidents." - Nathaniel Borenstein
 
Odgovor na temu

filmil
Filip Miletić
Oce Technologies B.V., inženjer
hardvera
Arcen, NL

Član broj: 243
Poruke: 2114
*.etf.bg.ac.yu

Jabber: filmil@jabber.org
ICQ: 36601391


+3 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 14:05 - pre 262 meseci
Citat:
Predrag Damnjanovic:

# gcc test.c -o test
/tmp/ccVGgwAM.o: In function `main':
/tmp/ccVGgwAM.o(.text+0x16): undefined reference to `cos'
collect2: ld returned 1 exit status


Predraže,

moraš obavezno dodati linkersku opciju -lm za linkovanje matematičke
biblioteke, ali obavezno na kraj komandne linije, ne u sredinu ili na
početak. Tako će sve biti u redu.

Dakle

Code:

# gcc -o test test.c -lm


Ne zaboravi takođe da pod UNIX-om postoji program /usr/bin/test koji je obično u PATH-u pre trenutnog direktorijuma tako da ćeš program morati da pokreneš sa:

Code:

# ./test


Pozdrav,
f
v.d. gcc psihijatar :)


p.s. E, da, mislim da je default skript za g++ (dakle za c++ kompajler pri gcc-u namešten tako da po defaultu linkuje i libm), možda otud ona tvrdnja da -lm nije potreban.

 
Odgovor na temu

alex
Aleksandar Radulovic
Senior Software Engineer, Spotify
Stockholm, Sweden

Član broj: 71
Poruke: 2194
*.itn.is

Jabber: alex@a13x.info
ICQ: -1
Sajt: www.a13x.info


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 14:11 - pre 262 meseci
Citat:
Predrag Damnjanovic:
Alex, hoces da se kladimo da na je na RH-u linkovan po defaultu? :)


Hocu da se kladim - RH koristim veoma dugo (jos od 4.2) i znam o cemu pricam.

Alex: My favorite site is http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x
 
Odgovor na temu

Predrag Damnjanovic
Predrag Damnjanovic
Nis, Srbija

Član broj: 141
Poruke: 1305
*.bankerinter.net

Sajt: www.mycity.rs


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 14:32 - pre 262 meseci
Citat:
filmil:
Ne zaboravi takođe da pod UNIX-om postoji program /usr/bin/test koji je obično u PATH-u pre trenutnog direktorijuma tako da ćeš program morati da pokreneš sa:

Code:

# ./test


U jeeeee, nisam znao :)

Alex, u sta se kladimo :)
 
Odgovor na temu

filmil
Filip Miletić
Oce Technologies B.V., inženjer
hardvera
Arcen, NL

Član broj: 243
Poruke: 2114
*.rcub.bg.ac.yu

Jabber: filmil@jabber.org
ICQ: 36601391


+3 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 15:28 - pre 262 meseci

Zahvaljujem.

f
 
Odgovor na temu

alex
Aleksandar Radulovic
Senior Software Engineer, Spotify
Stockholm, Sweden

Član broj: 71
Poruke: 2194
*.landspitali.is

Jabber: alex@a13x.info
ICQ: -1
Sajt: www.a13x.info


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 15:46 - pre 262 meseci
Citat:
Predrag Damnjanovic:
Alex, u sta se kladimo :)


Evo, probao sam na par masina kod mene:

Code:

login as: alex
Sent username "alex"
[email protected]'s password:
Last login: Thu Oct  3 14:33:57 2002 from rsp05.landspitali.is
[alex@postur alex]$ cat /etc/redhat-release
Red Hat Linux release 7.0 (Guinness)
[alex@postur alex]$ vi zastita.c
[alex@postur alex]$ gcc -o zastita zastita.c
/tmp/cceqD6ej.o: In function `main':
/tmp/cceqD6ej.o(.text+0x14): undefined reference to `cos'
collect2: ld returned 1 exit status
[alex@postur alex]$


To je bio RH 7.0

Code:

login as: alex
Sent username "alex"
[email protected]'s password:
Last login: Thu Oct  3 14:40:47 from rsp05.landspitali.is
[alex@apache alex]$ cat /etc/redhat-release
Red Hat Linux release 7.3 (Valhalla)
[alex@apache alex]$ gcc -o zastita zastita.c
/tmp/cc8sJCDm.o: In function `main':
/tmp/cc8sJCDm.o(.text+0x14): undefined reference to `cos'
collect2: ld returned 1 exit status
[alex@apache alex]$


To je bio RH 7.3

Trenutno nisam na poslu, pa ne mogu da se ulogujem na jos dve masine (RH 7.1 i RH 7.2), ali cu biti u firmi za par sati, pa cu i to probati i poslati ti rezultate.

Mada, zasigurno to nije ni potrebno, cim se libm.so ne linkuje po defaultu ni na 7.0 ni na 7.3..

Pozdrav,
alex.
Alex: My favorite site is http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x
 
Odgovor na temu

alex
Aleksandar Radulovic
Senior Software Engineer, Spotify
Stockholm, Sweden

Član broj: 71
Poruke: 2194
*.landspitali.is

Jabber: alex@a13x.info
ICQ: -1
Sajt: www.a13x.info


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 15:49 - pre 262 meseci
Kao sto rece filmil, po libm.so se po defaultu linkuje samo sa g++:
Code:

[alex@apache alex]$ g++ -o zastita zastita.c
[alex@apache alex]$


Inace, Peco, mozemo se kladiti u sta god hoces..
Alex: My favorite site is http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x
 
Odgovor na temu

Predrag Damnjanovic
Predrag Damnjanovic
Nis, Srbija

Član broj: 141
Poruke: 1305
*.bankerinter.net

Sajt: www.mycity.rs


+1 Profil

icon Re: Moj gcc ima shizofreniju: ne vidi sin, cos...03.10.2002. u 15:56 - pre 262 meseci
Javicu ti se kad instaliram RH.
 
Odgovor na temu

[es] :: C/C++ programiranje :: Moj gcc ima shizofreniju: ne vidi sin, cos...

[ Pregleda: 3643 | Odgovora: 14 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.