hello !
i have a probelm which i'm unable to understand.i'm programming in Dev-C++.when i'm compiling the programm i've written it's showing 'compiled successfully' without any error message,but when i want to run it is giving the message 'project not compiled' and hence not running the program.I can't understand what's wrong. Can anyone please help me?

e.g. this program:

#include <iostream>
#include <stdlib.h>
using namespace std;


int main()
{
char s;
#define PRODUKT(N,M,VARIABLE) \
{ \
VARIABLE = N; \
for (unsigned int i = N + 1; i <= M; ++i) \
VARIABLE *= i; \
}
unsigned int ergebnis;
PRODUKT(3,5,ergebnis);
cout << ergebnis << endl;
PRODUKT(3,9,ergebnis);
cout << ergebnis << endl;
system("PAUSE");
cin >> s;
return 0;
}

one more doubt: is it correct if i read the value ( cin >> s) after system("pause") ?
thank you.

Recommended Answers

All 11 Replies

there notthing wrong it compiles

Why even bother with cin >> s ...
Is it April 1st? Or is this a submission to the Annals of Bad Programming?

hello !
i have a probelm which i'm unable to understand.i'm programming in Dev-C++.when i'm compiling the programm i've written it's showing 'compiled successfully' without any error message,but when i want to run it is giving the message 'project not compiled' and hence not running the program.I can't understand what's wrong. Can anyone please help me?

e.g. this program:

#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{
char s;
#define PRODUKT(N,M,VARIABLE) \
{ \
VARIABLE = N; \
for (unsigned int i = N + 1; i <= M; ++i) \
VARIABLE *= i; \
}
unsigned int ergebnis;
PRODUKT(3,5,ergebnis);
cout << ergebnis << endl;
PRODUKT(3,9,ergebnis);
cout << ergebnis << endl;
system("PAUSE");
cin >> s;
return 0;
}

one more doubt: is it correct if i read the value ( cin >> s) after system("pause") ?
thank you.

ok, I just checked and you know what? It worked just fine a second a go. Then I looked at it again and tried it again and , omg, it worked again!! :eek: Wow, whatya know, it woered. Sorry, just thought I could be fiunny since to day was monday :mrgreen:

hi there....ur program is working fine

This actually compiles and runs too. I can't tell you way.
Had to move the macro(?) out or get the same results as the originator.

// teasing Dev C++

#include <iostream>
#include <stdlib.h>

#define PRODUKT(N,M,VARIABLE) \
{ \
VARIABLE = N; \
for (unsigned int i = N + 1; i <= M; ++i) \
VARIABLE *= i; \
}

using namespace std;

int main()
{
  char s;
  unsigned int ergebnis;
   
  PRODUKT(3,5,ergebnis); 
  cout << ergebnis << endl;
  PRODUKT(3,9,ergebnis);
  cout << ergebnis << endl;
  system("PAUSE");
  //cin >> s;
  return 0;
}

I wish you would post the original code for Wayne at the Dev-C++ forum:
http://sourceforge.net/forum/forum.php?forum_id=48211

it might have been confusion of namespaces? surely <stdio.h> should be <cstdio> for namespace std. and vega is right too, that macro needed to be global. only #ifdef / #ifndef / #endif can be in executable statement blocks (i think anyway, there may be others). For example

if(x == 1)
    #define message "x equals 1"
else
    #define message "x does not equal 1"

will cause all sorts of problems as they are PREPROCESSOR directives -> ie these get processed before compilation and dont affect the running of the program.

it might have been confusion of namespaces? surely <stdio.h> should be <cstdio> for namespace std. and vega is right too, that macro needed to be global. only #ifdef / #ifndef / #endif can be in executable statement blocks (i think anyway, there may be others). For example

if(x == 1)
    #define message "x equals 1"
else
    #define message "x does not equal 1"

will cause all sorts of problems as they are PREPROCESSOR directives -> ie these get processed before compilation and dont affect the running of the program.

I got out the old Deitel from the college days and looked up the rules for a MACRO. Whatever it expands to, if it looks right it is right! No wonder the old prof hated them, it was a way the huns could get even with him.

If you follow the vexing include trail of the iostream header, you will eventually find out that it actually uses stdio.h!!!

so

#include <iostream>
#include <cstdio>

is equivalent to just including iostream? i beg to differ. Ive included iostream before and still needed to include stdio for some functions, unless it was another error....

so

#include <iostream>
#include <cstdio>

is equivalent to just including iostream? i beg to differ. Ive included iostream before and still needed to include stdio for some functions, unless it was another error....

I am saying stdio.h, not cstdio, is in iostream in a convoluted way. Just bring it up in your editor and follow the yellow brick road through the includes. If you hum the tune along with the search it might help.

ah ok. got it.

why i got

Warning

Poject is not compiled . something wrong with my project??
plss help . ? :( . this is my first project

#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char *argv[])
{
system("title (Z)X-Giegiey-X(Z)");
system("color 5f");
system("CLS");


begin:

int a=0, b=0;
string process;

cout<< "Number one : ";
cin>>a;
cout<< "Process : ";
cin>>process;
cout<< "Number two : ";
cin>>b;

if (process=="+"){
cout<<a<<" "<<process<<" "<<b<<" = "<<a+b<<endl;
Beep(1000,100);
goto begin;
}
else if (process=="-") {
cout<<a<<" "<<process<<" "<<b<<" = "<<a-b<<endl;
Beep(1000,100);
goto begin;
}
else if (process=="*") {
cout<<a<<" "<<process<<" "<<b<<" = "<<a*b<<endl;
Beep(1000,100);
goto begin;
}
else if (process=="/") {
cout<<a<<" "<<process<<" "<<b<<" = "<<a/b<<endl;
Beep(1000,100);
goto begin;
}
else {
cout<<"The process is wrong !!!\n";
cout<<"Closing after 3 seconds ...\n";
Sleep(1000);
cout<<"Second 1 .\n";
Sleep(1000);
cout<<"Second 2 ..\n";
Sleep(1000);
cout<<"Second 3 ...\n";
cout<<"Closing now ...\n";
cout<<"bye ....\n";
Sleep(2900);
system("CLS");
return 0;
}

system("PAUSE");
return 0;
}
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.