Undefined Symbol "true"

Hello everyone. Please, give me a hand. There's an error message which says "Undefined symbol "true" "(line 26)

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

#include <math.h>

#include <iostream.h>

#include <conio.h>

#pragma hdrstop



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



#pragma argsused

int main(int argc, char* argv[])

{ float x,y,t,dt,V,a;

float g=9.81, Xm=250;

cin>>V>>a;

x=0;

y=0;

t=0;

dt=1;

float Z=Xm*random(1);

float Vx=V*cos(a);

float Vy=V*sin(a);

do

{ x=x+Vx*dt;

y=y+Vy*dt;

if (y<=0) break;

Vy=Vy-g*dt;

} while (true);

if (((x-Z)<1) &&((x-Z)>-1)) cout<<"Pobeda";

else

if (x<Z) cout<<"Nedolet";

else

if (x>Z) cout<<"Perelet";

getch();





return 0;

What old abandoned piece of software are you using? Perhaps it's time to get an up to date IDE/compiler instead of what you have now? "true" should be a keyword in C++ if you're using an up to date compiler.



What jlb said. You don't have any C++ headers in your program either. Also, please re-post this "code" in the code blocks (under Format:).
#pragma argsused
《Barfs》

What you're doing is not C++, it's very early non-standard code.
I would suggest a compiler such as GCC, and an IDE such as code blocks. Please.

But if you must...

It seems that you're using Embarcadero "RAD Studio" (or something similar).
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Bool,_true,_false,_bool_true_false_are_defined
Add #include <stdbool.h>
It's a C header.
Last edited on
It seems that you're using Embarcadero.
Unlikely.
Turbo C and c++ were from Borland.

Modern Embarcadero compilers have some backwards compatibility, but have supported bool and proper C++ headers for years.
Add #include <stdbool.h>
It's a C header.

In C++ you should not need to include a header file to use true, false, or bool, these are keywords in C++ no header needed.

Also since that compiler predates C99 <stdbool.h> would not exist.

I realize that and don't disagree, but me searching for "#pragma argsused" led me to a certain site that said how to get true/false to work. No confusion meant.

#pragma argsused seems to be Borland as Chervil pointed out.

This page says to add #include <bool.h> if your Borland compiler doesn't support the true/false keywords by default.
http://faculty.salisbury.edu/~dxdefino/boolfcns.htm

I reiterate that OP should use a modern compiler: If you're on windows, this is a nice pre-setup MinGW compiler https://nuwen.net/mingw.html
Last edited on
Topic archived. No new replies allowed.