# Upgrading from version 7 to 8 error while running consult/1 predicate

**URL:** <https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881>\
**Category:** Predicate\
**Tags:** bug, discussion, erlang, software\
**Created:** [April 28, 2021, 8:13am UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881 "2021-04-28T08:13:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![joaomarizgraca](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@joaomarizgraca](https://swi-prolog.discourse.group/u/joaomarizgraca)\
**Post date:** [April 28, 2021, 8:13am UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881/1 "2021-04-28T08:13:59Z")

</div>

Hello swi-prolog users,

I have developed a swi-prolog program to help me in my daily work. It was developed through several years so it has very large files of code.  
This software seemed to be fine until I have tried to run it using swi-prolog 8.2.4.

Now when I run consult/1 predicate I receive error messages which I report below. However this do not happen before, while using swi-prolog version 7.

Can anybody give me some help about this? Thank you in advance,

João

```prolog
ERROR: c:/users/windows/documents/prolog/common_phd/common0_main_structure.pl:11:
ERROR: catch/3: Unknown procedure: module/2
ERROR: However, there are definitions for:
ERROR: module/1
Warning: c:/users/windows/documents/prolog/common_phd/common0_main_structure.pl:11:
Warning: Goal (directive) failed: user:module(structure_main,[common_Editor/0,cE/0,abrir_Structure/0,dialog_salvar_sair_Structure/1,reDraw_structure_building/1,dia...

```

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 28, 2021, 8:28am UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881/2 "2021-04-28T08:28:42Z")

</div>

Looks like there is something in the file before the module header? AFAIK the only changes in this area are stricter checking, i.e., older versions handling incorrect declarations silently in some wrong way. If this doesn’t help, please include the start of the file.

---

<div class="post-metadata">

**Author:** ![joaomarizgraca](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@joaomarizgraca](https://swi-prolog.discourse.group/u/joaomarizgraca)\
**Post date:** [April 28, 2021, 9:44am UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881/3 "2021-04-28T09:44:34Z")

</div>

Since the problem remained I include the start of the file,

Thanks

```prolog
:- module(common_MaterialsDB,
[ mzCAD_data_base/9, rctCAD_data_base/4,
exp_toc_mzCAD/1, exp_toc_rctCAD/1,
mzCAD_materials_DataBase/0, rctCAD_materials_DataBase/0,
dialog_Material_Regular/1, create_Material_Regular/10,
dialog_Material_Glass/1, dialog_Material_Air/1,
converter_Write2File_BaseDados/2, abreviatura_para_Texto/2,
materials_Radiance/0 ]).

:- require([defs/2, change_icon_dialog_2/2,
ver_RctCAD_Current_Object/1, ver_ePLus_Current_Object/1,
dialog_Radiance_Material/3, dialog_Radiance_Material_Glass/3,
dialog_Radiance_Texture/3 ]).
/*
material_construcao(nome), object
*/
:- use_module(library(pce_toc)).

```

Jan Wielemaker via SWI-Prolog \<[swiprolog@discoursemail.com](mailto:swiprolog@discoursemail.com)\> escreveu no dia quarta, 28/04/2021 à(s) 09:38:

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 28, 2021, 11:12am UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881/4 "2021-04-28T11:12:53Z")

</div>

That looks fine, unless there is something hidden at the start of the file. Assuming that is not the case the next suspicious cause are term\_expansion/2 rules that expand the module header by adding something before it. Does the problem go away if you only load this file? If so I’d search for term\_expansion that might do strange things and otherwise bisect the problem by removing and re-adding parts of the rest of the program. Seems a weird issue …

---

<div class="post-metadata">

**Author:** ![joaomarizgraca](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@joaomarizgraca](https://swi-prolog.discourse.group/u/joaomarizgraca)\
**Post date:** [April 28, 2021, 12:25pm UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881/5 "2021-04-28T12:25:38Z")

</div>

Perhaps there are things that might cause problems, For instance

I have a statement like the following one which is below the code that I have just sent to you

:- pce\_image\_directory(‘c:/Programas/swipl/xpce/bitmaps/48x48/’).

Thank you so much

Jan Wielemaker via SWI-Prolog \<[swiprolog@discoursemail.com](mailto:swiprolog@discoursemail.com)\> escreveu no dia quarta, 28/04/2021 à(s) 12:22:

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 28, 2021, 12:48pm UTC](https://swi-prolog.discourse.group/t/upgrading-from-version-7-to-8-error-while-running-consult-1-predicate/3881/6 "2021-04-28T12:48:26Z")

</div>

This as such still works as it is used all over the place in the xpce libraries. We really need a (preferably) small complete piece of code and what to do. As is, it is magic and just about anything may cause this. Could you (for example) load this file using include/1?
