fatal error: 'random.h' file not found Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
aclassifier
Respected Member
Posts: 483
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

fatal error: 'random.h' file not found

Post by aclassifier »

Solved, see bottom of post!

I have a new project where the compiler all of a sudden complains: fatal error: 'random.h' file not found

I have several other projects in the same workspace where this file is seen, the module compiled and run.

This new project has xc and cpp files, but the others have xc and c.

The module_random is included with USED_MODULES = lib_spi module_random. The .include lists are equal. The usages are equal.

In .build I find a directory called

Code: Select all

/_m_random/src
    random_init.c.pca.xml
    random_init.c.pca.xml.decouple
but where it works this directory looks like this:

Code: Select all

/_m_random/src
    random_init.c.d
    random_init.c.o
    random.xc.d
    random.xc.o
Besides from that I don't have any other clues, or where to look further.

Here is the full log:

Code: Select all

xmake CONFIG=Default all 
Checking build modules
Using build modules: lib_spi(3.0.2) module_random
Analyzing __arduino_radiohead_on_xmos_port.xc
Analyzing xccompat_arduino.xc
../src/XMOSArduinoCompat/xccompat_arduino.xc:13:10: fatal error: 'random.h' file not found
#include "random.h"
         ^
../src/XMOSArduinoCompat/xccompat_arduino.xc:20:1: warning: type defaults to `int' in declaration of `random_generator_t' [-Wimplicit-int]
random_generator_t random_seed = random_create_generator_from_seed(0);
^~~~~~~~~~~~~~~~~~
../src/XMOSArduinoCompat/xccompat_arduino.xc:20:1: warning: data definition has no type or storage class [-Wunusual-code]
random_generator_t random_seed = random_create_generator_from_seed(0);
^~~~~~~~~~~~~~~~~~
../src/XMOSArduinoCompat/xccompat_arduino.xc:20:20: error: parse error before "random_seed"
random_generator_t random_seed = random_create_generator_from_seed(0);
                   ^
../src/XMOSArduinoCompat/xccompat_arduino.xc:20:20: warning: type defaults to `int' in declaration of `random_seed' [-Wimplicit-int]
random_generator_t random_seed = random_create_generator_from_seed(0);
                   ^~~~~~~~~~~
../src/XMOSArduinoCompat/xccompat_arduino.xc:20:20: warning: data definition has no type or storage class [-Wunusual-code]
random_generator_t random_seed = random_create_generator_from_seed(0);
                   ^~~~~~~~~~~
../src/XMOSArduinoCompat/xccompat_arduino.xc:20:34: error: unknown function identifier `random_create_generator_from_seed' (possibly missing prototype?)
random_generator_t random_seed = random_create_generator_from_seed(0);
                                 ^
../src/XMOSArduinoCompat/xccompat_arduino.xc:42:30: error: unknown function identifier `random_get_random_number' (possibly missing prototype?)
    unsigned random_number = random_get_random_number(random_seed); // [0..2exp32-1]
                             ^
xmake[1]: *** [.build/src/XMOSArduinoCompat/xccompat_arduino.xc.pca.xml.decouple] Error 1
xmake: *** [analyze] Error 2

12:51:41 Build Finished (took 597ms)
And here is the contents of xccompat_arduino.xc.pca.xml.decouple:

Code: Select all

<preCompilationAnalysis file="/Users/teig/workspace/module_random/src/random_init.c">
</preCompilationAnalysis>
Tool:

Code: Select all

Index | Search for Unresolved Includes
Index | Re-resolve unresolved Includes
does not help

I have been looking at Library API file not found and neither "random.h" nor <random.h> make any difference. And of course I have done Clean Project, before I posted this question.

However, when I did Clean Project again now, it didn't complain! So I guess I'll mark this as Solved!


--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
View Solution
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

So I guess I'll mark this as Solved!
Awesome - self solving issues. The best kind.
Post Reply