[Error] ld returned 1 exit status

Hi, guys!

This is my first attempt using DevC++ at my computer. I`ve already looked in the forum for this error, but I was unnable to find a sollution. I`d like to know how to fix this.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream> 

using namespace std;

int main() 
{
float n,r; 
cout<< "\n Informe o numero"; 
cin>>n;
r=n*n;
cout<< "\n O resultado eh:"<<r; 
return 0; 
} 
This program should work just fine, I copied your code and I have no problem compiling or running this. Are you getting any errors or what is going wrong?

If the problem is just that it closes right after inputting a number, try adding:
1
2
cin.get();
cin.get();

At the bottom of the code, before 'return 0'.

This causes the program to wait for the user to tap the enter key before exiting.
Last edited on
I've just figured it out. The app was running so I oppened my "gerenciador de tarefas"(my pc is in portuguese) and ended the process. Now it's working. Thanks for the help anyway!
Topic archived. No new replies allowed.