Board index » cppbuilder » Compiler defines in options dialog.

Compiler defines in options dialog.

In builder 1 and 3 they work.  In builder 4, they appear to be getting
ignored.  Anyone else have defines in the page
project|options|directories/conditionals page?

Howard N. Egan

 

Re:Compiler defines in options dialog.


: Howard Egan <h...@got.net> wrote:

Quote
>In builder 1 and 3 they work.  In builder 4, they appear to be getting
>ignored.  Anyone else have defines in the page
>project|options|directories/conditionals page?

I just checked and they work for me.

Steps:
* File | New application...
* Add code to the constructor so that it reads

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{

#ifdef Hello

  Error!

#endif

Quote
}

* Make

   ---> No problem

* Project | Options --> Conditional Defines: Enter "Hello" (without
quotation marks)

* Build (or modify unit1.cpp and Make) <-- did you do that?

  --> [C++ Error] Unit1.cpp(17): E2451 Undefined symbol 'Error'.

Works as expected, I would say?

--
Stefan Hoffmeister      http://www.econos.de/
Please do apply judgement when sending email.

Re:Compiler defines in options dialog.


You did exactly what I did except I am using an existing project.  
Mine does NOT work.
Quote
Stefan Hoffmeister (TeamB) wrote:

> : Howard Egan <h...@got.net> wrote:

> >In builder 1 and 3 they work.  In builder 4, they appear to be getting
> >ignored.  Anyone else have defines in the page
> >project|options|directories/conditionals page?

> I just checked and they work for me.

> Steps:
> * File | New application...
> * Add code to the constructor so that it reads

> __fastcall TForm1::TForm1(TComponent* Owner)
>   : TForm(Owner)
> {

> #ifdef Hello

>   Error!

> #endif

> }

> * Make

>    ---> No problem

> * Project | Options --> Conditional Defines: Enter "Hello" (without
> quotation marks)

> * Build (or modify unit1.cpp and Make) <-- did you do that?

>   --> [C++ Error] Unit1.cpp(17): E2451 Undefined symbol 'Error'.

> Works as expected, I would say?

> --
> Stefan Hoffmeister      http://www.econos.de/
> Please do apply judgement when sending email.

Re:Compiler defines in options dialog.


: Howard Egan <h...@got.net> wrote:

Quote
>You did exactly what I did except I am using an existing project.  
>Mine does NOT work.

Please show us a little bit of source code how you use the define and
tell me what you have in

  Project | Options --> Conditional Defines:

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Re:Compiler defines in options dialog.


Howard,BCB4 makefiles added a SYSDEFINES section. What doesyour makefile look
like for following section (taken from
a default .BPR):

# ---------------------------------------------------------------------------

PATHCPP = .;
PATHASM = .;
PATHPAS = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
USERDEFINES =
SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
# ---------------------------------------------------------------------------

CFLAG1 = -I$(BCB)\include;$(BCB)\include\vcl -Od -Hc -H=$(BCB)\lib\vcl40.csm
-w -Ve -r- \
 -a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tW -tWM \
  -D$(SYSDEFINES);$(USERDEFINES)

Other Threads