954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

no error message but showing project not compiled

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

imon
Newbie Poster
1 post since Dec 2004
Reputation Points: 10
Solved Threads: 0
 

there notthing wrong it compiles

yb1pls
Newbie Poster
24 posts since Dec 2004
Reputation Points: 11
Solved Threads: 1
 

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

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 
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 #include 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:

mikeSQL
Junior Poster
196 posts since Dec 2004
Reputation Points: 16
Solved Threads: 3
 

[B]hi there....ur program is working fine

harshchandra
Junior Poster in Training
68 posts since Nov 2004
Reputation Points: 7
Solved Threads: 1
 

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.
[php]
// teasing Dev C++

#include
#include

#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;
}
[/php]

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

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

it might have been confusion of namespaces? surely should be 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.

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

it might have been confusion of namespaces? surely should be 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!!!

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

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

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

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.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

ah ok. got it.

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

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;
}
giegiey
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You