Hi Everyone.
I'm kind of new.
For some weeks I've been studying cpp using devcpp and it worked just fine.
I changed my PC and now I am trying to program in Builder c++. I am reading a Builer tutorial and Im doing OK with the frames and all of the visual components. But When I open one of my old cpp files separtedly they don´t run. Should I use DEV C++ for .cpp files and Builder for projects. Can´t Builder build and run my simple cpp old files?

Thanks a lot!!!

10 Years
Discussion Span
Last Post by nachon

>Can´t Builder build and run my simple cpp old files?
Builder has no problem with standard C++. Quite likely your "simple" C++ programs aren't conforming to the standard, and thus are only guaranteed to work on the compiler that they were written with. Post your code and the errors Builder is throwing, somebody here can tell you what's wrong.


This is what I'm Doing:
1. Open Builder C++
2. Close the Project
3. File -> New -> Other -> cppFile
4. This is the code I write

#include <iostream>
using namespace std;

int Add (int x, int y)
    cout << "In Add(), received " << x << " and " << y << "\n";
    return (x+y);

int main()
    cout << "I`m in main()! \n";
    int a,b,c;
    cout << "Enter two numbers: ";
    cin >> a;
    cin >> b;
    cout << "\nCalling Add () \n";
    cout << "\nBack in main(). \n";
    cout << "c was set to " << c;
    cout << "\nExiting... \n\n";
    return 0;

5. I Save this file, but the Run button on the bar is deactivated and F9 does nothing.

I really can´t see the mistake.


Try creating a project instead of just a new file. You can add the existing .cpp file to the project, or delete it and add a new one once the project is created.


Thanks NARUE. I right clicked the .cpp file and opened it with Borland C++. Then It asked me if I wnated to link the file to a project, I accepted and it worked.
I consider this thread closed!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.