Is this a bug?

Patrick Uiterwijk puiterwijk at redhat.com
Mon Jan 19 08:50:45 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

On Fri, Jan 16, 2015 at 08:12:15PM -0700, Ashoordin wrote:
> Hello friends,
> I am new with Fedora 21 but I am trying to learn C++ as well. So, in my
> compilation command of

First of all, this might be the wrong list for this, as this list if for Fedora Infrastructure stuff.

> "g++ -Wall `root-config --cflags --ldflags --libs` example.cpp" I am
> receiving the error message
> "/usr/lib/gcc/i686-redhat-linux/4.9.2/../../../crt1.o: In function `_start':
> (.text+0x18): undefined reference to `main'
> collect2: error: ld returned 1 exit status"

This means you forgot to define a function called main in example.cpp: https://wwwx.cs.unc.edu/~sparkst/howto/cpp_main.php

> After changing the compilation command to
> "g++ -ansi -Wall -I /usr/include -c example.cpp"
> I no longer receive the error.
> However during linking command
> "g++ -L /usr/lib/../../../ crt1.o *.o -lgsl -lgslcblas -lm"
> I receive the following error message
> "g++: error: crt1.o: No such file or directory"
> But, I know for sure that there is such a file. So, what could be wrong?

Note you have a space between /usr/lib/../../../ and crt1.o, so it's searching for crt1.o in the current directory.

> 
> Thanks for everyone's help,
> Ashur

- -- 
With kind regards,
Patrick Uiterwijk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJUvMVlAAoJEIZXmA2atR5QV+IP/1ECQr8bl/JA5oXWsR0VDX9r
R5B5mOazYNTIFQeVin1GIARgyJsrae5rEv30vPXvGf/pzuWeLwkB3pvou0hl60DU
cJnViO7wUvQjlFJ6Af4aMXHrvPzqnz8/sVGq/p/6JUn/yP5hoT45Rt3r7sx6C20n
PlfIH0IxPMyq1VHvyWJwNAHPa6nuo4GS+nCJcL835qgqAiBGtSKA+7uPJIShD9Re
mR+8xhOvLlVLxcjXL9B6sJp/unKiu6NJGSb1/boYMQu2dBb/ziIrAJ8I0NUbK206
tVAVo1KV9c0HZPybmTEmAiKhXz1NZPiPGYBjddGMCvatQrh8Gpj0FyCIc1phGqmu
RKIEvf/xzapItQB0WhzX8s5IzrE0kiOLG/vGIWQ6QIb2pTLa+y1F8MAV8rpepowR
4drwd1WKRAjSPduPHqJCbu50n5RWS2Iqub1NK1AIMjTYTpe686AH9W+NSkhlEuZZ
Miqn/TXHiYi2eevfuhDoMjxyFpiqWebikADC7XM0vBM8gCMIELJYvFWbhGAHFdT3
NTB+ZZaEQiVkMkg77aWRoXVIWkCrCniS4OFdfbr4RI9KY3NI8SLtbnwQBGJbK2PC
3GhE19c96t9nV2Y2BUne20wVhkF9i5wXBt5orclWUuguw1Fzc/YC9Vs3S/nxSzHA
aHMbqhRVeeSbuj6r1f74
=SkLU
-----END PGP SIGNATURE-----


More information about the infrastructure mailing list