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!!!

Recommended Answers

All 4 Replies

>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.

OK,
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";
    c=Add(a,b);
    cout << "\nBack in main(). \n";
    cout << "c was set to " << c;
    cout << "\nExiting... \n\n";
    system("pause");
    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.
Thanks

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.

OK.
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!
Thanks!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.