"Uncompiled source file" error

Asked

Viewed 2,946 times

1

I am using Dev-C++. I compile and when I run the message appears:

source file not compiled

What am I doing wrong?

#include <stdio.h>
main()
{
    float lado, area ;
    cout<< "digite o lado";
    cin>> lado;
    area= lado*lado;
    cout<< area;

  system("PAUSE");  
  return 0;
}
  • 1

    When you have other problems and ask other questions, ask more details. This is a very simple case and I could see right away what was wrong, but in most cases if you don’t put everything you are using, describe what you are trying to do, give details, show the error that occurs, where, when, etc. the question will be closed because it is not clear, until you improve it.

  • Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?

1 answer

2

You are mixing C with C++. The first thing to do is to decide whether to program in one language or the other. Since it looks like C++, I’ll try to get it right for her:

#include <iostream>
using namespace std;

int main() {
    float lado;
    cout << "digite o lado";
    cin >> lado;
    float area = lado * lado;
    cout << area;
}

Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.

The changes I’ve made:

  • I put the right header, the iostream containing the cin and cout. What you’re using is C header.
  • I put a using so you don’t have to call the method by its full name, so you don’t have to use std::cin, for example.
  • And I got the function guy main() that returns a int, then you have to type her.

Then if you want you can improve for the output to be more presentable.

I gave one organized in the code too. Get used to doing this. It’s important.

Fixing these things should compile. Mine compiled. I don’t know in C++ DEV because it’s a pretty bad IDE.

  • +1 for the correct explanation. Perhaps it would be interesting to supplement the answer with the reasons why you consider that DEV C++ is not a good IDE.

  • @Alexandrecartaxo I don’t think it would fit here. I would need a specific question. But it would have to be very well done not to be broad or based on opinions.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.