Hi,
I have always programed in Turbo C 3.0 and little exp. with 4.5 but recently I installed Borland C++ Builder 6 and the environment is completely diifferent..
I was just testing some codes to get used to this new environment..
But this code below is giving an error i've never experienced before..
can any one pls help..
thnx in Advance..

/*EvaluatePrimeNo.cpp */

#include<iostream>
#include "EvaluatePrimeNo.h"
using namespace std;
bool EvaluatePrimeNo::isPrime(int a)
{
    int flag=0;
        for(int i=2;i<=a-1;i++)
        {
            if(a%i==0)
            {
                flag=0;
                break;
            }
            else
            {
                flag=1;
            }
            
        }
        if(flag==0)        
        return 0;
        else if(flag==1)
        return 1;
}

int main()
{
    EvaluatePrimeNo n;
    int num=94;
    cout<<n.isPrime(num);
}

/*EvaluatePrimeNo.h*/

class EvaluatePrimeNo {

public:
bool isPrime(int a);

};

and this is the error I'm getting..

[C++ Warning] EvaluatePrimeNo.cpp(24): W8070 Function should return a value
[Linker Fatal Error] Fatal: Could not open C:\Program Files\Borland\CBuilder6\Projects\Project1.exe (error code 5)

Recommended Answers

All 12 Replies

You declare main() to return an 'int' type... but nowhere do you have a 'return' statement in your main() function.

int main()
{
...
...
yadda yadda
....
...
etc etc.
....
...
...
return 0;
}

well dat is giving the warning.. not this linking error..

Hi,
I'm getting the same error in just install Borland C++, did you manage to fix it?

Thanks in advance

i wish that i can find a solution for this

[Linker Fatal Error] Fatal: Could not open C:\Program Files\Borland\CBuilder6\Projects\Project1.exe (error code 5)[C++ Warning] EvaluatePrimeNo.cpp(24): W8070 Function should return a value
[Linker Fatal Error] Fatal: Could not open C:\Program Files\Borland\CBuilder6\Projects\Project1.exe (error code 5)

Hi,
did you have a look in the folder [C:\Program Files\Borland\CBuilder6\Projects\] to see if Project1.exe is there at all?

If this is a "new" Borland installation you may need to change some of the settings.

thanks alot dingbats

yes it is new installation

and i did not finf the files

but i try to save it in different folder

and i think that problem is solved

but now new error came to me that

http://up.arab-x.com/Dec10/hRm21927.jpg

FYI

i add the library to the folders
builder c++

and i added also into the new folder which i save my projects into it

sience 4 days what i am doin

is installinf and uninstall

and try to many solutions

but until now i could not write single code and it works

i am reaaly fustrated :(

//---------------------------------------------------------------------------

#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
int a,b,c;

a=ReadIntPr("Please Enter the 1st Mark");
b=ReadIntPr("Please Enter the 2ndt Mark");
c=ReadIntPr("Please Enter the 3rdt Mark");


        return 0;
}
//---------------------------------------------------------------------------

Hi Hussein,

I did the course that you're now doing. If you follow their instructions exactly then everything will work. Is the mt262 course work correctly installed?

belive me dingbats

i did every and each step

and i am still getting these errors

and u r right it is MT262 part 1

You should register/use the OU FirstClass system - that's where all the students (and teachers) "hang out".

Very helpful conferencing system and you'll probably find others who are experiencing the same problem.

Have you copied mt262io.lib into the same folder where your project is and then tried Project | Add...? I ask because in your screenshot it's not listed.

commented: his advise was vey useful to me +1

thanks alot dingbats

yes i add the library

then i try to restart the system and begin from zero

then i tried

and suprisely

without doing or modfying anything it works!!!!!!!!!!

i just started

and it is good advice to login into firstclass and hang with them

but is it work out of UK?

again and again thanks alot

The OU works from all over the world just like the www. I studied (and still live) in Germany.

Good luck

(P.S. Don't forget to close this thread)

just run the c++ builder as administrator.
right-click on the c++ builder icon -> run as administrator

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.