May I know what this error means and how I may get around it? I'm sure gcc is installed correctly so I'm not sure what is the cause of this problem. The file is also in the same directory as Cygwin.
This error pops up even after reinstalling and updating, I ran the setup exe 3 times but the same issue persists.
$ gcc -g -o lab1 lab1.c
cc1: fatal error: lab1.c: No such file or directory
compilation terminated.
Related
I'm getting an error in the compilation of a C file that heavily uses Raylib function.
Environment
OS: Windows 10
IDE: Visual Studio Code
Raylib version: 4.2.0 (win64, mingw)
Sanity check of Raylib installation
Following the discussions in How to add Raylib to VS code?, I successfully compiled an example code: main.c in this link. That means, the Raylib function is correctly installed, and the path to the source libraries is also set correctly.
Compilation of my code
Using the set of JSON files (c_cpp_properties.json, launch.json, settings.json, tasks.json) used in the example code, I'm trying to compile my code. There are several ways to compile code on VS code.
Compilation by F5 key
In this case, I get the following messages on my terminal:
Executing task: C:\MinGW\bin\mingw32-make.exe RAYLIB_PATH=C:/raylib/raylib PROJECT_NAME=MyCode OBJS=MyCode.c BUILD_MODE=DEBUG
mingw32-make: *** No targets specified and no makefile found. Stop.
It seems like I need to make a Makefile to configure the compilation but I have no idea how to write it. I tried using the Makefile in link but it caused an error. I probably need to make a code-specific Makefile but I have no clue.
Compilation by command #1
I also tried to compile my code by running the following command on VS code terminal:
gcc MyCode.c lib/librarylib.a -o MyCode
but I got the following error message:
fatal error: raylib.h: No such file or directory
The header file raylib.h is not recognized even though I used the same header in the example code I compiled earlier. The path to the header is also set properly.
Compilation by command #2
To set the path to the file location of raylib.h more explicitly, I used the following command instead:
gcc -Wall -IC:\raylib\raylib\src MyCode.c MyCode.exe -l/librarylib -o a.out
Note that the C:\raylib\raylib\src is the path to a folder that contains raylib.h. This time I got the following error:
gcc.exe: error: MyCode.c: No such file or directory
gcc.exe: error: MyCode.exe: No such file or directory
Some clues ...
I got this code from another guy. The code was originally developed on M1 mac, and it was compiled successfully by the following command:
clang -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL lib/libraylib.a MyCode.c -o MyCode
I am using Ubuntu 18.04.4, and Eclipse 2019-12 (4.14.0) and I try to create a little C application with the help of Glade for the user interface.
Adding the following header files in C results in "unresolved inclusion" error:
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
I have searched and tried in many ways to fix this, but unfortunately I didn't manage (I am new to linux/eclipse). The most easy solution seems to be a package called "Pkg-config" that knows itself how to add the gtk package, but unfortunately, this version of Eclipse does not support it.
The compiler sends the following error:
10:22:19 **** Incremental Build of configuration Debug for project MyTestProject ****
make all
Building file: ../src/MyTestProject.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/MyTestProject.d" -MT"src/MyTestProject.o" -o "src/MyTestProject.o" "../src/MyTestProject.c"
../src/MyTestProject.c:17:10: fatal error: gtk/gtk.h: No such file or directory
#include <gtk/gtk.h>
^~~~~~~~~~~
compilation terminated.
src/subdir.mk:18: recipe for target 'src/MyTestProject.o' failed
make: *** [src/MyTestProject.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
10:22:19 Build Failed. 3 errors, 0 warnings. (took 466ms)
Any ideas how I can solve this? I mention that libgtk-3-dev is installed on my system and it appears inside the "includes" folder.
I'm new to linux, and am trying to compile and install some libraries.
Unfortunately, things are quite difficult as I am unable to obtain sudo access to my machine, and had to install the libraries in non-standard locations.
I'm having trouble getting the compiler to find the libraries I installed.
One of the libraries (https://github.com/tpm2-software/tpm2-tss/blob/master/INSTALL.md) I'm trying to install has dependencies on the other libraries, and I am getting the following error code when trying to compile, and am unable to fix it.
src/tss2-esys/esys_crypto_ossl.c:11:10: fatal error: openssl/evp.h: No such file or directory
#include <openssl/evp.h>
compilation terminated.
make[1]: *** [Makefile:14063: src/tss2-fapi/api/libtss2_fapi_la-Fapi_AuthorizePolicy.lo] Error 1
In file included from ./src/tss2-fapi/fapi_int.h:11, from src/tss2-fapi/api/Fapi_ChangeAuth.c:18:
./src/tss2-fapi/ifapi_policy_instantiate.h:13:10: fatal error: json-c/json.h: No such file or directory
#include <json-c/json.h>
compilation terminated.
So far, I've been trying to compile it in bash using the following commands:
./bootstrap
export PKG_CONFIG_PATH=/home/me/test/lib/pkgconfig:$PKG_CONFIG_PATH
export LDFLAGS='-L../missing_libs -lssl -L../missing_libs -lz -L../missing_libs/json-c/.libs -ljson-c -L../missing_libs/curl-7.68.0/lib/.libs -lcurl -L../openssl-1.0.2 -lcrypto'
export CFLAGS='-I../missing_libs/curl-7.68.0/include/lib:../missing_libs/json-c:../missing_libs/openssl-1.0.2'
./configure --prefix=/home/me/test --with-udevrulesdir=/lib/udev --disable-doxygen-doc
make -j$(nproc)
The LDFLAGS are the folders that contain my .so and .a files, while the CFLAGS are the folders that contain my h files.
Can I check if anyone knows what I am not linking properly?
Thanks!
I found the problem. Apparently I was linking to the wrong place.
Since library was searching for , I should not link to the directory where json.h is, but the directory where json-c/json.h is.
So for my CFLAGS should be "-I../missing_libs" instead of "-I../missing_libs/json-c"
Thanks for the help Jonathan!
Whenever I try to compile c/cpp files it gives this error:
gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
I have also tried to include full path of file while compiling but same error occured.
Just to be sure of version mismatch I looked for both gcc and g++ version but both are same,
gcc/g++ version: 9.1.0.
How can I fix this?
as command is from binutils. Have you installed this package?
The problem seems to be gcc not being able to locate as - the GNU assembler.
Try locating it in /usr/bin/as that where it should be. If that is where it exists, the order of your $PATH variables might be the issue.
Can you output the $PATH.
I'm getting a weird error at C header files when linting with linter-gcc at atom. The error is this:
cc1: error: output filename specified twice
This error is generated by: gcc 5.2.1, ubuntu 15.10.
The same error is generated by gcc 5.3.0 at my linux arch system 4.5.0-1 ARCH.
When I checked with clang 3.7.1 all went fine.
Note that I can compile the program normally. The error is generated only inside atom editor or when I run this command at my terminal:
/usr/bin/gcc -Wall -fsyntax-only -c -fmax-errors=0 /path/to/headerfile.h
But when I run:
clang -Wall -fsyntax-only -c /path/to/headerfile.h
Nothing was printed.
EDIT: It seems that it's not linter-gcc's bug as I contacted the package's creator via his github account.
So my question is: What's is the source of this error? Is there a way to solve it? What's causing it?