HBMK2 a file at a time

163 views
Skip to first unread message

José Quintas

unread,
Jul 31, 2020, 5:11:08 PM7/31/20
to harbou...@googlegroups.com
Is possible compile 1 source at command using hbmk2?

Situation:

#include "a.ch"

#include "b.ch"

but b causes redefinition

When compile all source code using a unique command, I receive the
message but do not know what source code causes the problem.


José M. C. Quintas

Anand Kr Gupta

unread,
Aug 2, 2020, 4:31:07 AM8/2/20
to harbou...@googlegroups.com
We need to see the content of a.ch and b.ch
There is some ' redefinition' in them.

Anand
Working from Home


--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/f015ee02-46fa-7641-79f6-f5d7dd34d9f7%40gmail.com.

Vlad

unread,
Aug 2, 2020, 5:31:02 AM8/2/20
to Harbour Users
File a.ch

#ifdef ELEMENT_A
#define ELEMENT_A
... more defines and pseudo commands
#endif

File b.ch
#ifdef ELEMENT_A
#define ELEMENT_A
... more defines and pseudo commands
#endif

Vlad

unread,
Aug 2, 2020, 5:50:55 AM8/2/20
to Harbour Users
correction:

#ifndef , not #ifdef

José Quintas

unread,
Aug 2, 2020, 9:56:20 AM8/2/20
to harbou...@googlegroups.com

CH content is ok, order on PRG is wrong.

What PRG?

I do not know, except if review each of thousands PRGs.

HBMK2 group PRGs and CHs, and I receive the error without to know what is the PRG with problem.

file1..ch

#define X 1


file2.ch

#ifdef X

#undef X

#define X 2

#endif


file1.prg

#include "file1.ch"

#include "file2.ch"


file399.prg

#include "file2.ch"

#include "file1.ch"


Error on HBMK2:

gcc file1.prg file2.prg file3.prg file4.prg .... file450.prg

redefinition on ch


What is wrong PRG? No option except review each one prg


José M. C. Quintas

Anand Kr Gupta

unread,
Aug 3, 2020, 5:51:16 AM8/3/20
to harbou...@googlegroups.com
The problem is in file399.prg

It has #include "file1.ch"after #include "file2.ch"
so without #undef X, giving error redefine

Anand
Working from Home


José Quintas

unread,
Aug 3, 2020, 8:58:45 AM8/3/20
to harbou...@googlegroups.com

Found, can't use -q on this situation.

Harbour consider error on CH, because error occurs processing CH

But in this situation error is on PRG, using incorrect order to ch

And using -q I do not have PRG name.


test1.ch:1: warning W0002  Redefinition or duplicate definition of #define x


Without -q ok

d:\temp>hbmk2 test.hbp

Compiling 'test1.prg'...

Lines 6, Functions/Procedures 0
Generating C source output to 'C:\Users\jmcqu\AppData\Local\Temp\hbmk_7o2dry.dir\test1.c'... Done.

Compiling 'test2.prg'...

test1.ch:1: warning W0002  Redefinition or duplicate definition of #define x

No code generated.

José M. C. Quintas

test.zip

José Quintas

unread,
Aug 3, 2020, 9:03:31 AM8/3/20
to harbou...@googlegroups.com

The error:

#include "test2.ch"

#include "test1.ch"


correct:

#include "test1.ch"

#include "test2.ch"


error is not CH, but PRG #include order.


José M. C. Quintas

Anand Kr Gupta

unread,
Aug 3, 2020, 9:07:40 AM8/3/20
to harbou...@googlegroups.com
As I pointed out.
Good it solved the problem

Anand
Working from Home


José Quintas

unread,
Aug 3, 2020, 9:15:52 AM8/3/20
to harbou...@googlegroups.com

problem was not about solve problem

problem was to discover what was the files


At the same time:

- message error is correct about kind of error

- message error is wrong, because do not show correct file


Once #include becomes part of PRG, seems that correct error message could be PRG and #include line.


José M. C. Quintas

José Quintas

unread,
Aug 3, 2020, 9:30:47 AM8/3/20
to harbou...@googlegroups.com

        -ge[<mode>]      error output <mode>: 0=Clipper (default)
                                                1=IDE friendly

Current error message may be considered not compatible with -ge1 IDE friendly

from prg #include line I know about ch file name, but from ch name I can't to know about prg name

José M. C. Quintas

Reply all
Reply to author
Forward
0 new messages