Posts

Showing posts with the label main

Undefined main when main is defined [on hold]

Undefined main when main is defined [on hold] I'm using Ubuntu 18.04 on Windows 10 and I have installed the gcc. Before this, I had no trouble compiling the .cpp but recently I'm encountering this error /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" I even tried to compile this dummy code but the error still occurs. #include <iostream> using namespace std; int main() { cout <<"whyn"; } How can I fix that? This question appears to be off-topic. The users who voted to close gave this specific reason: How do you build your program? Can you show us the exact commands that leads to the error? And are you sure you build with the right source or object files? – Some programmer dude Jun 29 at 15:36 ...