Sunday, June 5, 2022

[SOLVED] GCC not able to locate files in the directory

Issue

Below is the script that runs gcc: build_hello_tf.sh:

#!/bin/bash
TARGET_DIRECTORY="$(pwd)/src/addons/tensorflow/"
echo ${TARGET_DIRECTORY}
gcc -L${TARGET_DIRECTORY} hello_tf.c
ls ${TARGET_DIRECTORY}

Here is it's output:

/home/karl/dev/node/tensorflow/src/addons/tensorflow/
gcc: error: hello_tf.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
hello_tf.c  src

It looks like gcc is not able to locate the source file in the directory.


Solution

As said in the comments :

-L is the library search path. Source files are not searched there. You have to name them with the full path.



Answered By - Badda
Answer Checked By - Willingham (WPSolving Volunteer)