[Exchange and share] g++ not working
Tofloor
poster avatar
Loonhy
deepin
2022-12-10 20:33
Author

I just installed Deepin 23 and write a simple c++ program:

#include 

int main()  {
    std::cout << "Hello Deepin" << std::endl;
}

and I complie it with command

g++ -o test test.cpp

Yet the compiler gives me

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o: in function _start': (.text+0x17): undefined reference to main'
collect2: error: ld returned 1 exit status

What's going wrong here?

Reply Favorite View the author
All Replies
Loonhy
deepin
2022-12-14 00:29
#1

NVM. I didn't save the file.

Reply View the author
seoo
deepin
2022-12-18 09:13
#2
It has been deleted!
lo******[email protected]
deepin
2022-12-26 18:03
#3
It has been deleted!