Hello friends, I am new with Fedora 21 but I am trying to learn C++ as well. So, in my compilation command of "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" 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?
Thanks for everyone's help, Ashur
On Fri, 2015-01-16 at 20:12 -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 "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"
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?
Ashur,
Please use the channels listed here for troubleshooting. This mailing list is for infrastructure related discussion only.
https://fedoraproject.org/wiki/Communicating_and_getting_help
-----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
infrastructure@lists.fedoraproject.org