cd "/home/furkan/Desktop/denemee/" && g++ Untitled-1.cpp -o Untitled-1 && "/home/furkan/Desktop/denemee/"Untitled-1
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
it gives such an error. what should I do?
code:
#include<iostream>
using namespace std;
int main()
{
cout << "hello world" << endl;
return 0;
}
echo "int main(){return 42;}" | g++ -x c++ -o runme - && ./runme
? If the program is compiled, it will run and return the exit code 42, that you can check right after./runme
by using the commandecho $?
.