error

Write your question here.

#include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x;
y=x*2;
cout<<z;
return 0;
}
Last edited on
[Running] cd "c:\Users\Asus\Desktop\hh\" && g++ tst1.cpp -o tst1 && "c:\Users\Asus\Desktop\hh\"tst1 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 0.535 seconds
vc code
error: ld returned 1 exit status
Looks like you created a Windows app instead of a console app.
Calling those posts "sentence fragments" is too generous.

aghiad,
1. open your command prompt (cmd)
2. cd to the directory that tst1.cpp is in
3. type g++ tst1.cpp -o tst1

What is the output (if any)?
Is tst1.exe created?

Edit:
cout<<z;
You never defined z!!!! That's your first problem right there.
Last edited on
Topic archived. No new replies allowed.