I am a beginner and I use Gcc compiler. At least, I used, because it suddenly stopped working giving me this error
cc1: fatal error: cannot open '/c/Users/UTENTE~1/AppData/Local/Temp/cc8t2W16.s' for writing: No such file or directory
where "UTENTE" means "USER" and the .s file changes every time. This result is given to every code I tried to compile, the command was
gcc filename.c
and my OS is Windows. Can anyone help me? Maybe in really simple language, because I am very new...
Related
I just started trying to program in C and I've downloaded all kinds of IDE's and compilers and nothing seems to be working. Cygwin keeps giving me this error when i try to compile my program:
C:\Users\Paul\Documents\Timmy
λ gcc -o nutt nutt.c
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld:
cannot open output file nutt.exe: No such file or directory
collect2: error: ld returned 1 exit status.
here is my program
#include <stdio.h>
int main(void) {
printf("y");
return 0;
}
I also want to point out that i have this strange issue when i try to use the "save as" features in notepad or notepad++. when i try to save something this way it will bring up an error message saying the file isn't found and to check the file name and try again. both of these issues seem to have occured around the same time, i'm not sure if they are related. I try saving this way by setting the file type to all types and i just type in "something.c" for the name.
I fixed it! thank you guys for trying to help. I fixed it by turning off controlled folder access in my windows defender security center.
https://answers.microsoft.com/en-us/windows/forum/windows_10-files/cant-save-to-documents-folder-after-fall-creators/b1274473-6dcd-4bbf-8040-6ba1bc79287f
I can now use the save as features and compile my C source files.
I kept trying to google stuff about gcc when it was really window's fault...
I'm trying to compiler c code using Hightec compiler under win7 64bit operating system. Here is my sample Batch code for compiling:
Root\HightecInstall\bin\ppc-vle-gcc -fno-inline -c -o sample.o sample.c
This is only a sample code with the compiler options "-fno-inline". After I run the batch file, I got an error saying "unknown compiler options -no-inline". But what I input is "-fno-inline". So there is a missing letter "f". I have tried with other options and the output always gave me "unknown compiler options ***" which misses one or two letter at the beginning. For example. -DDefault -> unknown -efault. I don't really understand how that could happen and how could the compiler discard the first one or two letters. Does anyone have some suggestions? Thanks.
Bo
I am new to C and I am trying to compile a code that uses am external library. Therefore, I am following these steps for linking a library. But at the very first one
gcc -c -Wall -Werror -fpic PICASO_SERIAL_4DLIBRARY.C
I get this
PICASO_SERIAL_4DLIBRARY.C:1:0: error: -fpic ignored for target (all code is position independent) [-Werror]
#include <windows.h>
cc1plus.exe: all warning being treated as errors
additionally undder # there is a arrow above. I tried googling it but I could only find out that this is a Linux problem and not a Windows one (I am developing on Windows now) and the I followed these steps to install gcc. an compiling other small projects work, too.
Anyone any idea, why this doesn't work?
The mention of #include <windows.h> is incidental. That just happens to be the first line of code.
The compiler tries to associate a line of code with the error to help you find the problem. But in this case the code is irrelevant. The error is in the command line and you will get a failure no matter what the code is. But because the compiler is coded to always associate a line of code with an error, it decides, arbitrarily, to point the finger at the first line of code.
Because you use -Werror, warnings are treated as errors. The compiler therefore converts a warning about an ignored option to emit position independent code into an error. The error message states this very clearly:
PICASO_SERIAL_4DLIBRARY.C:1:0: error: -fpic ignored for target (all code is position independent) [-Werror]
I suspect you glazed over when reading the error message, and turned your attention to the line of code that was highlighted. Always read error messages carefully!
To resolve the error, remove the -fpic option from your command line.
Try to compile without -fpic. This flag is inappropriate for the mingw-w64 target.
I am using MATLAB on the Linux MINT. I have a C program for which I want to used mex command as follows:
mex /home/.../binary.c -output binary_m
but I get the following error
Warning: You are using gcc version "4.8.1-10ubuntu9)". The version
currently supported with MEX is "4.4.6".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
/home/.../binary.c:43:19: fatal error: binary.h: No such file or directory
#include "binary.h"
^
compilation terminated.
mex: compile of ' "/home/.../binary.c"' failed.
I think that I have to downgrade the gcc compiler on the MATLAB but I don't know how.
Any help is appreciate it.
Regards
This has nothing to do with the warning regarding the compiler version; don't pay attention to that, you will be fine. You might have had problems trying to compile c++11 sources, depending on your Matlab version, compiler version and mex command flags, but this is not your case.
Here is the problem: your C program binary.c contains an #include statement of the file binary.h which is not found by Matlab (although I trust you put it in the same directory than the C file?) because the directory that contains your C sources is not in the Matlab path.
To fix the problem, simply change directory to where binary.c is, and mex your file there. You can automate the process doing something like:
source_dir = '/home/.../';
current_dir = fileparts(mfilename('fullpath'));
cd source_dir;
% do something
cd current_dir;
Hello everyone I'm learning C and am trying to figure out how to run it through the command console cmd. I have eclipse installed along with Mingw and added these to the path:
C:\MinGW\bin\;C:\MinGW\msys\1.0\bin
I wrote this program on notepad++ for a quick test run and save it to C:\test.c and also under a folder C:\Users\Pikachu\Music\C code while I was trying to figure it out:
#include <stdio.h>
int main()
{
printf("Hey, Buddy!\n");
return 0;
}
On the cmd console I typed:
c:\>gcc test.c
and got the error message:
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/id.exe: cannot ope
n output file a.exe: Invalid argument
collect2.exe: error: ld returned 1 exit status
When I typed:
c:\>cd c:\Users\Pikachu\Music\c code
and then:
gcc test.c
it just skipped a line as if nothing happened and went back to square one:
c:\Users\Pikachu\Music\c code>gcc test.c
c:\Users\Pikachu\Music\c code>
I was wondering if anyone knows what's going on and could help me out, I'd be so happy if I could see "Hey, Buddy" from cmd! Does anyone also know why I get the error message running it from c:\ and nothing when I run it from the Music\c code\test.c folder even though I'm supposedly running the same file test.c?
I've tried searching around and have picked up references on how the computer can't link to the proper dll's however I'm not sure how to implement this to my specific problem.
Oh and curiously enough when I tried to save another file in c:\ I got a message saying that I didn't have permission to do that even though 5 minutes prior I had done just this. Any insights?
Thanks for your help!
When you run gcc on your C source file, all that it will do it generate an executable file. I believe its called a.exe by default but I would recommend naming it with the -o option:
gcc text.c -o test.exe
Once your file is successfully compiled, run the executable to say hello to the worls:
c:\Users\Pikachu\Music\c code> .\test.exe
As for the first error you got, maybe it has to do with gcc not being able to create the output executable on the root c: folder. I would recommend doing your coding some folder your user owns instead of on a system folder for this reason.
By the way, gcc supports many other options. I highly recommend using -Wall to turn on warnings and choosing what version of the C standard to follow (-std=c99 or -ansi, together with the -pedantic flag).