Batalf
asked on
C++ Project in Borland C++ 4.52
Hi
I'm just a beginner in C++, and now I have a problem with the "thing" called project. I have a lot of files, which I want to put into a project. Do anyone of you have an idea how to do that in BC++ 4.52.
When I Choose Project -> New Project, three files are beeing generated. (ex : test.cpp, test.def and test.rc). What are these files used to. I've tried putting some code into test.cpp and then tried to run the program. But nothing happens.
Can anyone help me??
I'm just a beginner in C++, and now I have a problem with the "thing" called project. I have a lot of files, which I want to put into a project. Do anyone of you have an idea how to do that in BC++ 4.52.
When I Choose Project -> New Project, three files are beeing generated. (ex : test.cpp, test.def and test.rc). What are these files used to. I've tried putting some code into test.cpp and then tried to run the program. But nothing happens.
Can anyone help me??
These files are just created to get you starting to write code.
You are able to do not BC4.51 create these files. In the NewProject-dialog you should click the Advanced button. In this dialog you can choose between .cpp, .c, or no source node. Also you can set whether or not to create a .def-file and/or .h-file.
Probably you know the use of .cpp/.c (source) and .h (header). The .def-file is used to set your compiler-settings. As you are new to this, you will not be interested in this file. If you set the radio-button to no-source and unset the other two check-boxes, you will start with an empty project.
After creating the empty project you can add nodes (=your source files).
A project always needs a file wich contains the main-function. If this function exists then your project will link correctly and will run.
You are able to do not BC4.51 create these files. In the NewProject-dialog you should click the Advanced button. In this dialog you can choose between .cpp, .c, or no source node. Also you can set whether or not to create a .def-file and/or .h-file.
Probably you know the use of .cpp/.c (source) and .h (header). The .def-file is used to set your compiler-settings. As you are new to this, you will not be interested in this file. If you set the radio-button to no-source and unset the other two check-boxes, you will start with an empty project.
After creating the empty project you can add nodes (=your source files).
A project always needs a file wich contains the main-function. If this function exists then your project will link correctly and will run.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Adjusted points to 150
ASKER
Hi
Thanks for fast reply.
Now, I have tried making a "dummy"-project. I start up with just one "cpp-file", and there I typed in this simple code :
#include <fstream.h>
void main(void)
{
cout << "Hei" ;
}
I compiled it and everything was working ok, but when I run it, it just give me a blink and that's it.
What could be wrong.
Thanks for fast reply.
Now, I have tried making a "dummy"-project. I start up with just one "cpp-file", and there I typed in this simple code :
#include <fstream.h>
void main(void)
{
cout << "Hei" ;
}
I compiled it and everything was working ok, but when I run it, it just give me a blink and that's it.
What could be wrong.
Yes, it is finished very quickly and then closed. You can set a break point on the closing brace or main's return. Or add a input request for the user
#inlcude <iostream.h>
int main() // ANSI demands main() to return an int
{
cout << "Hei" << endl;
int i;
cin >> i; // cause the program to wait for input
// alternatively you can set a breakpoint on the return statement
return 0;
}
#inlcude <iostream.h>
int main() // ANSI demands main() to return an int
{
cout << "Hei" << endl;
int i;
cin >> i; // cause the program to wait for input
// alternatively you can set a breakpoint on the return statement
return 0;
}
ASKER
To Kangaroo
I've tried your suggestion too, but nothing happens.
Could it have something to do about what kind of Project I choose :
Platform : Win32 and
Target Model : GUI
Maybe that's what wrong?
Regards
Batalf
I've tried your suggestion too, but nothing happens.
Could it have something to do about what kind of Project I choose :
Platform : Win32 and
Target Model : GUI
Maybe that's what wrong?
Regards
Batalf
>>Target Model : GUI
change Target Model to EasyWin (or Concole) and you code will work.
change Target Model to EasyWin (or Concole) and you code will work.
Ah, off course. You can not use console related IO from a GUI app (I should have thought of that). Try creating a console app like Alex suggests.
ASKER
Thanks in advance :-)
Batalf