Can't compile executable from .c file to ntfs formated partition

I have been trying for a long time to solve an obvious problem with compiling simple C code into an executable. I made simple C code that should print the size in bytes of a file double

in .txt

via a makefile. It doesn't compile the executable on my system, but it works flawlessly on my university Linux server. I am running Linux Mint 17.1 64bit with cc version " cc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 ". My test C code is in the file temp.c

:

#include <stdlib.h>
#include <stdio.h>

int main( void )
{
    printf("sizeof(double) returns %lu\n", sizeof(double));
    return 0;
}

      

Mine makefile

looks like this:

CFLAGS = -Wall -m64 -std=c99

all: A;

A:out.txt

out.txt: temp;
    ./temp > out.txt
    chmod go+r

temp: temp.o

clean:
    rm temp.o
    rm temp out.txt

      

Typing cc -dumpversion

while logging into my universities linux server returns " cc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)

" and typing " cc-dumpmachine

" returns " x86_64-redhat-linux

"

I don't understand why make all

on my machine it returns

cc -Wall -m64 -std=c99   -c -o temp.o temp.c
cc   temp.o   -o temp
./temp > out.txt
/bin/sh: 1: ./temp: Permission denied
make: *** [out.txt] Error 126

      

Additional Information: temp.c

Located in the NTFS partition folder, which is automatically installed when booting with the exec option . Compiling temp.c

without -c

from the shell instead of the makefile doesn't do the job. Every time I try to run ./temp

or whatever, the compilation result is returned by a statement Permission denied

.

+3


source to share


1 answer


As the OP pointed out in the comments, the executable is in NTFS format. By default, Ubuntu (and therefore I would prefer Mint) does not mount NTFS in such a way that files can be executed.

Quoting from the answer on AskUbuntu by @Sebastian (modified), the following change should be made to /etc/fstab

:



The solution was to write the exec

mount option after the option users

. This is because the option users

implicitly activates the parameter noexec

, so you need to specify it explicitly exec

.

+6


source







All Articles