Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22307

simple c++ "hello world" wont run with this error (.text+0x20): undefined reference to `main'

$
0
0

hello i just want to compile this simple c++ code with vscode

#include <iostream>
using namespace std;
int main(){
    cout<<"hi";
    return 0;
 }

and i try to compile it with this command

g++ main.cpp

BUT i get this error !

/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
    (.text+0x20): undefined reference to `main'
    collect2: error: ld returned 1 exit status

Viewing all articles
Browse latest Browse all 22307

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>