Need help to run the my 1st code of C++(hello world code) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need help to run the my 1st code of C++(hello world code)

the output shows - [Running] cd "c:\Users\DELL\Desktop\hello world\" && g++ hello.cpp -o hello && "c:\Users\DELL\Desktop\hello world\"hello c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status [Done] exited with code=1 in 3.753 seconds My code: #include<iostream> Using namespace std; Int main() { Cout<<"hello world"<<endl; Return 0;

10th May 2021, 12:42 AM
Sachin EDU
Sachin EDU - avatar
5 Answers
+ 2
{ Cout<<"hello world"<<endl; Return 0; }
10th May 2021, 12:51 AM
Alfonso Farías
Alfonso Farías - avatar
+ 1
I think it’s a duplicate question. Anyway, there are a good number of videos out there on YouTube which show how one could setup the VS Code for C/C++ development. You could just watch one of those. Since, you’re using MINGW, I think Codeblocks could be a better choice to start your learning. l find it troublesome to setup VS Code for C++, so I normally use Makefile for the build process. Or write the code in the editor and compile the program using a terminal. Personally, I’d suggest you to use Visual Studio itself, IMO it’s the best IDE for C/C++. To solve your current “winmain” issue, you can pass “-mconsole” linker flag in your VS Code cpp settings (a json file, in the project directory). This may/may not work. Good luck!
10th May 2021, 2:12 AM
Flash
0
Flash It works Now the out put is- [Running] cd "c:\Users\DELL\Desktop\hello world\" && g++ hello.cpp -o hello && "c:\Users\DELL\Desktop\hello world\"hello hello world [Done] exited with code=0 in 2.031 seconds So is this what the output should be or .....
10th May 2021, 2:56 AM
Sachin EDU
Sachin EDU - avatar
0
Need help to run the my 1st code of C++(hello world code) the output shows - [Running] cd "c:\Users\DELL\Desktop\hello world\" && g++ hello.cpp -o hello && "c:\Users\DELL\Desktop\hello world\"hello c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status [Done] exited with code=1 in 3.753 seconds My code: #include<iostream> using namespace std; Int main() { cout<<"hello world"<<endl; return 0;
10th May 2021, 10:55 PM
‎Ameer hassan
‎Ameer hassan - avatar
0
#include<iostream> using namespace std; int main() { cout<<"hello world"<<endl; return 0; }
11th May 2021, 8:50 AM
senz
senz - avatar