PDA

View Full Version : .exe file created by c programming through gcc compiler isn't executing.



dmp_mech
August 17th, 2012, 07:23 AM
I am new in linux. I am using ubuntu 12.04 LTS. I am writing c program which contains math. I am creating executable file through the command:

gcc -o filename.exe filename.c -lm (compilation)

this will create a filename.exe file. I can now execute it through terminal command:

./filename.exe (execution)

I have laptop. It has ubuntu 11.04. I store files in ntfs partition. These sequence of commands works well in my laptop. But if same file I copy in my desktop's ntfs partition, which is ubuntu 12.04 LTS, and then runs then it doesn't work. It compiles but doesn't executes. I am getting the answer:

bash: ./filename.exe: Permission denied

I searched in internet. They suggested that you can change the permission of file by below command:

chmod u+x filename.exe

But I got same answer: Permission denied. I tried manually through GUI through property --> permission --> checking "allow executing file as program". is not working. It uncheckes automatically. I searched in the internet and I got answer that it is not advisable to change permission for every file each and every time of execution. better you can change permission of entire ntfs partition by following command:

chmod -R 777 /media/partition where partition is ntfs type.

This is supposed to change the partition permission to rw and executable mode. But this is also not solving my problem.


Please help me.
Patadiya Dharmesh M.

Deepak J
August 17th, 2012, 08:40 AM
even i'm a newbie so i don't know much about this permission changing and all those...

But well I know one thing ie. if you are attempting to do some major changes you have to add the command sudo before all the major change causing commands in the command line.

Sudo actually takes the permission to the super user lvl...

If you've tried that too then I'm sorry...

Someone else who is more experienced can help you...

dmp_mech
August 17th, 2012, 09:14 AM
even i'm a newbie so i don't know much about this permission changing and all those...

But well I know one thing ie. if you are attempting to do some major changes you have to add the command sudo before all the major change causing commands in the command line.

Sudo actually takes the permission to the super user lvl...

If you've tried that too then I'm sorry...

Someone else who is more experienced can help you...

I tried that also. I got the following answer in terminal:

$ sudo ./hello.exe
[sudo] password for patadiya:
sudo: ./hello.exe: command not found

albandy
August 17th, 2012, 09:31 AM
NTFS does not support POSIX file permissions.
You have to mount this partition with the exec flag.

anewguy
August 17th, 2012, 09:41 AM
IF I understand what you are saying, you are putting the files in a Windows partition of type NTFS? You would be much, much better off putting them in your Linux home folder (or subfolder within that), compiling them there, and executing there. If the files are going on an ntfs partition, the permissions like you are trying to do won't work.

IF, by chance, what you are trying to do is develop a program in Linux, compile and link it in Linux, resulting in a Linux executable file, but trying to store that program, executable, etc., in a Windows partition so you can try to execute in it in Windows, that isn't going to work.

If you compile and link in Linux, you must run it in Linux. To run in Windows, the program must have been compiled and linked using a Windows based compiler and linker.

If you want the same source, but want to compile it to run in Windows and run in Linux, you might need to look into mingw (sp?) for Windows. I may not have the name correct, but it's a windows package that includes a linux command line and the gcc stuff. You can then use the same source in Windows or Linux, but you must use mingw to compile in Windows, and gcc to compile in Linux. There is no "common" executable. The architectures are completely different. Of course, there are free tools available in Windows to compile/link C and other programming languages - once such "package" it the Microsoft Visual Studio Express.

How did you install your Ubuntu - is it a wubi install, a dual-boot install, or a stand-alone install?

What folder is the source code in?

Do you want the executable in the same folder?

You should change it from filename.exe to just filename as exe is a Dos/Windows file type, while most Linux executables appear to have followed a naming convention of just "filename". You could then also just double-click on "filename" using the file browser and it should run. Leaving it as .exe will cause that to come up with error message(s) about not knowing what to use to open the file.

Post the following:

- what folder the source is in
- using "ls -al", a list of the files in that folder
- what folder the executable is in
- using "ls -al", a list of the files in that folder

Deepak J
August 17th, 2012, 09:49 AM
$ sudo ./hello.exe
[sudo] password for patadiya:
sudo: ./hello.exe: command not found[/QUOTE]


The thing is that you have created an executable file by compiling your prgm in windows(ie. the .exe extn), but unfortunately these kinds of executable files will only execute in the windows platform and not in Linux or Unix platforms..

Either you can follow anewguy (http://ubuntuforums.org/member.php?u=331304)'s - advice or compile your source code in Linux using gcc complier which will give and executable (usually it is a.out unless specified) and then run it using ./a.out.

Hope this is gonna work

mlentink
August 17th, 2012, 10:02 AM
The thing is that you have created an executable file by compiling your prgm in windows(ie. the .exe extn), but unfortunately these kinds of executable files will only execute in the windows platform and not in Linux or Unix platforms..

gcc -o filename.exe filename.c -lm (compilation)

Does windows even have a gcc compiler? OP said he was using 12.04 and compiled with gcc.
anewguy's remarks are on the spot.

@OP: please post the info anewguy asked

Deepak J
August 17th, 2012, 10:11 AM
Does windows even have a gcc compiler? OP said he was using 12.04 and compiled with gcc.
anewguy's remarks are on the spot.

@OP: please post the info anewguy asked

Srry, I didn't note that.... :oops:

mlentink
August 17th, 2012, 10:16 AM
Srry, I didn't note that.... :oops:
No worries, just trying to avoid confusion...

dmp_mech
August 17th, 2012, 11:18 AM
$ sudo ./hello.exe
[sudo] password for patadiya:
sudo: ./hello.exe: command not found


The thing is that you have created an executable file by compiling your prgm in windows(ie. the .exe extn), but unfortunately these kinds of executable files will only execute in the windows platform and not in Linux or Unix platforms..

Either you can follow anewguy (http://ubuntuforums.org/member.php?u=331304)'s - advice or compile your source code in Linux using gcc complier which will give and executable (usually it is a.out unless specified) and then run it using ./a.out.

Hope this is gonna work[/QUOTE]

I have compiled in gcc compiler only not in windows' compiler (like turbo). Even I have mentioned command terminal also. a.out is common file generated after compiling. It will be overwritten everytime whenever you compile onother file. The solution of this problem is to create individual .exe files. Like I created.

gcc -o filename.exe filename.c -lm.

This command will create filename.exe (won't create a.out)file which is particularly for that .c file(here it is filename.c) only. If I give command:

gcc -lm filename.c

then it will create a.out file. It will give out put. But let say you are creating other c file, say hello.c. If you compile

gcc -lm hello.c

then it will give output file a.out. This will overwrite data of previously generated a.out file, which was created through gcc -lm filename.c.

dmp_mech
August 17th, 2012, 11:19 AM
NTFS does not support POSIX file permissions.
You have to mount this partition with the exec flag.

How can I do this? I am beginner. Can you explain me?

anewguy
August 17th, 2012, 11:38 AM
Read my post and reply with answers. It will be difficult for anyone to help you without knowing exactly what you are doing. Right now, what you posted is a little cryptic, and that's why you see varying replies. Please explain very clearly.

anewguy
August 17th, 2012, 11:48 AM
Yes, the default is a.out. However, you can put ANY file name there you want to. I can not more highly suggest you NOT use a suffix - particularly .exe.

If you want to create a shell script you can and you can pass the program name in as an arguement.

Best-practice, especially since you are just starting:

IF the program is in C:

- name the source what ever you want with a suffix of .c

- name the output(executable) the same as the source but with no suffix

Examples:

(1) program name: myprogram.c output(executable) myprogram
(2) program name: runmefirst.c output(executable) runmefirst
.
.
.
.

BUT, before we get to any of that, PLEASE post the requested information.

Also, I suspect English is not your native language. If true, we may be able to find an Ubuntu forum in your native language. A personal note - I envy anyone who knows more than 1 language - I've never been able to learn another.

Deepak J
August 17th, 2012, 11:52 AM
why filename.exe and not filename.out.... ???


.out is the one reorganised by linux right...?

dmp_mech
August 17th, 2012, 12:00 PM
IF I understand what you are saying, you are putting the files in a Windows partition of type NTFS? You would be much, much better off putting them in your Linux home folder (or subfolder within that), compiling them there, and executing there. If the files are going on an ntfs partition, the permissions like you are trying to do won't work.

IF, by chance, what you are trying to do is develop a program in Linux, compile and link it in Linux, resulting in a Linux executable file, but trying to store that program, executable, etc., in a Windows partition so you can try to execute in it in Windows, that isn't going to work.

If you compile and link in Linux, you must run it in Linux. To run in Windows, the program must have been compiled and linked using a Windows based compiler and linker.

If you want the same source, but want to compile it to run in Windows and run in Linux, you might need to look into mingw (sp?) for Windows. I may not have the name correct, but it's a windows package that includes a linux command line and the gcc stuff. You can then use the same source in Windows or Linux, but you must use mingw to compile in Windows, and gcc to compile in Linux. There is no "common" executable. The architectures are completely different. Of course, there are free tools available in Windows to compile/link C and other programming languages - once such "package" it the Microsoft Visual Studio Express.

How did you install your Ubuntu - is it a wubi install, a dual-boot install, or a stand-alone install?

What folder is the source code in?

Do you want the executable in the same folder?

You should change it from filename.exe to just filename as exe is a Dos/Windows file type, while most Linux executables appear to have followed a naming convention of just "filename". You could then also just double-click on "filename" using the file browser and it should run. Leaving it as .exe will cause that to come up with error message(s) about not knowing what to use to open the file.

Post the following:

- what folder the source is in
- using "ls -al", a list of the files in that folder
- what folder the executable is in
- using "ls -al", a list of the files in that folder

Thank you for reply.
1. I have dual os. I have 4 partitions. One is xp-64 bit, second is ubuntu 12.04 and other 2 partitions are of NTFS type. I require to run some programs in windows also. So for that I have to formate other 2 partitions in NTFS because linux formatted files can not be accessible in to the windows but NTFS is accessible in ubuntu.

2. Other thing you suggested, put files in home folder. But in past time I faced one problem. Once my os(ubuntu) had problem and crashed. It needed re installation. As you suggested, I did store the data in home folder. But due to crashing the os was not starting and the only solution was format and reinstall. I lost all the data stored in home folder.

3. This is problem in my desktop. But same type of partitions are present in my laptop. There is not such problem. I can compile the c program in NTFS partition also. At that time one of my friend did something in file system's one file. He wrote something in /etc/fstab(I'm not sure which was the file). I don't know what he did but I was able to compile in NTFS partition also.

4. I install it through wubi. Actually I downloaded the 12.04 lts(64 bit) from ubuntu's official website.

http://www.ubuntu.com/download/desktop

5. I give you some detail about my partitions.
/dev/sda9 it is linux installation. ( this partition is not accessible in windows)
/dev/sda8 it is swap memory. ( this partition is not accessible in windows)
/dev/sda7 on /media/aero ntfs-3g (this partition is accessible in windows and I want it to be)
/dev/sda6 on /media/mech ntfs-3g (this partition is accessible in windows and I want it to be)
/dev/sda1 on /media/xp-64 ntfs-3g (this partition is accessible in windows and I want it to be)

my working folder is "c-programmin" which is in "aero" partition. i.e. /media/aero/c-programming. I want executable files in the same folder.

6. As you suggested, I should change from filename.exe to filename only. I tried that also. I did:
gcc -o filename filename.c -lm

But it gives same answer:
bash: ./filename :Permission denied.

7. I think it is not advisable to create a.out file through:

gcc -lm filename.c

because each and everytime it is overwritten when I compile other c file. Let say I compile hello.c file through below command
gcc -lm hello.c (this command will create a.out file)

instead of gcc -o hello.exe hello.c -lm. ( This command will create hello.exe file and it will not overwrite previous a.out file.)

will also create a.out file. But this a.out will overwrite previous a.out file created by compiling filename.c.

8. I am writing your suggestion to use the command ls -al:
patadiya@patadiya:/media/aero/c-programming$ ls -al
-rw------- 1 patadiya patadiya 8379 Aug 17 10:24 hello
-rw------- 1 patadiya patadiya 62 Aug 17 05:39 hello.c
-rw------- 1 patadiya patadiya 81 Aug 17 05:38 hello.c~
-rw------- 1 patadiya patadiya 8379 Aug 17 05:53 hello.exe
-rw------- 1 patadiya patadiya 1496 Aug 17 05:49 hello.o

Source code and executable files are in the same folder. To generalize the question I have used filename.exe, filename.c or filename. I have created other file names.

dmp_mech
August 17th, 2012, 12:15 PM
Yes, the default is a.out. However, you can put ANY file name there you want to. I can not more highly suggest you NOT use a suffix - particularly .exe.

If you want to create a shell script you can and you can pass the program name in as an arguement.

Best-practice, especially since you are just starting:

IF the program is in C:

- name the source what ever you want with a suffix of .c

- name the output(executable) the same as the source but with no suffix

Examples:

(1) program name: myprogram.c output(executable) myprogram
(2) program name: runmefirst.c output(executable) runmefirst
.
.
.
.

BUT, before we get to any of that, PLEASE post the requested information.

Also, I suspect English is not your native language. If true, we may be able to find an Ubuntu forum in your native language. A personal note - I envy anyone who knows more than 1 language - I've never been able to learn another.

I read post. I replied. You are correct that English is not my native language. I'm very bad in grammar.

oldos2er
August 17th, 2012, 04:06 PM
Thread moved to Programming Talk.

trent.josephsen
August 17th, 2012, 05:54 PM
why filename.exe and not filename.out.... ???


.out is the one reorganised by linux right...?
No, Linux recognizes no file name extension for any purpose. Some applications may interpret them but they aren't significant to the system at large. You could name your program program.exe, program.bin, program.out, program.mp3, program.txt, program.wonderfullylongfileextensionthatiscomplete lyuseless or program.program.program.program if you wanted to and it would make no difference to how it gets run.

Thing is, in Linux there's nothing significant about a dot (.) in a filename, so you can't leave off or infer the filename suffix. In Windows you can run the program "foo.exe" by typing "foo", but in Linux you have to type the whole thing. This is kind of pointless and for several reasons it's better just to name it what you want to call it. Otherwise we'd all be typing "ls.out" all day.

Vaphell
August 17th, 2012, 06:11 PM
2. Other thing you suggested, put files in home folder. But in past time I faced one problem. Once my os(ubuntu) had problem and crashed. It needed re installation. As you suggested, I did store the data in home folder. But due to crashing the os was not starting and the only solution was format and reinstall. I lost all the data stored in home folder.

when that happens, run system from livecd/usb, but instead of installing choose testing desktop in live mode. That gives you usable desktop environment and when you mount the partitions on hdd, access to the data trapped there. Then you can save data to external hdd or pendrive (which you should have for backup purposes, disks die, misclicks happen and having a single copy of anything is asking for disaster) or transfer to another computer using ftp, ssh or whatever. Don't try to save anywhere on live cd/usb, usually it lacks persistent storage and will 'forget' in the next run that you copied anything (though usb can be made to have persistence).

Another option is installing the system with separate /home partition (in manual setup mode).
Once you do that, you can reinstall without touching user related data. System installation destroys the data on partition the core components are installed to, so separate /home makes user data safe, because /home is not /.
During reinstall simply mark /home to be /home in new setup and make sure 'format' checkbox is left alone.
Fresh system simply picks up user config and files right off the bat, which makes it very convenient to fix annoying problems by reinstallation and you are up and running in 20 minutes.

ofnuts
August 17th, 2012, 06:40 PM
Just to add to the noise:

- if the OP expect to compile something in Linux an execute it on Windows, then he can forget about it

- if the OP want to compile on Linux and run on Linux then his problem may that he is keeping the executable ("somefile.exe", which should better be named just "somefile" as many have pointed out) on an NTFS filesystem on which the executable flag isn't supported. IIRC there is an option to make NTFS either report the executable flag as always on, or to emulate it with the archive flag, and this maybe what his friend did on his other computer. This sais I don't see much purpose in keeping this file on NTFS because Windows willl never do anything with it.

Vaphell
August 17th, 2012, 06:52 PM
if the OP expect to compile something in Linux an execute it on Windows, then It can forgeyt about it

why? doesn't cross compiling exist?


$ i586-mingw32msvc-gcc hw.c -o hw.exe
$ file hw.exe
hw.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
$ wine hw.exe
Hello world

ofnuts
August 17th, 2012, 07:54 PM
why? doesn't cross compiling exist?


$ i586-mingw32msvc-gcc hw.c -o hw.exe
$ file hw.exe
hw.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
$ wine hw.exe
Hello world

Granted... still a different kettle of fish.

anewguy
August 18th, 2012, 12:37 AM
Mingw is one of the things I mentioned in my post, having done cross-platform development in C and GTK myself.

I think the problem really is that the files are on an NTFS partition. If you look at the output the OP provided from my ls -al request, you'll see only owner has rw permission, nobody has execute, and no other users can even see the things.

This suggests a couple of things:

- the files need to be stored in a linux partition (I prefer a subfolder off my home folder myself)

- the OP needs to be sure they own the folder

- the OP needs to be sure when they place the executable there that the executable bit is set in the permissions

As for other parts of the discussion, "filename" means any file name - like I showed in my post.

Also, if you tell us your native language we can check to see if there is/are ubuntu forum/forums in your native language as that might make it easier for you. You are doing fine with English, and I didn't mean to imply anything other that we might be able to find a native language forum for you if it would be easier for you. Sorry if what I wrote might have been misinterpreted.

dmp_mech
August 21st, 2012, 06:17 AM
Thread moved to Programming Talk.

Where is the programming talk?

dmp_mech
August 21st, 2012, 06:32 AM
Just to add to the noise:

- if the OP expect to compile something in Linux an execute it on Windows, then he can forget about it

- if the OP want to compile on Linux and run on Linux then his problem may that he is keeping the executable ("somefile.exe", which should better be named just "somefile" as many have pointed out) on an NTFS filesystem on which the executable flag isn't supported. IIRC there is an option to make NTFS either report the executable flag as always on, or to emulate it with the archive flag, and this maybe what his friend did on his other computer. This sais I don't see much purpose in keeping this file on NTFS because Windows willl never do anything with it.

But problem is we are using other mechanical softwares like Pro-e, Catia etc. which run in Windows only (It may be run in Linux also but I don't have that version). For that I need some output data from executable file of C programming. Like suppose I want to plot temperature vs. time plot. Now if I write the C program and create executable file.
I can do it through following command lines:

gcc -o temperature temperature.c -lm

./temperature > temperature.txt (this will execute the temperature file and parallely will write output in temperature.txt file. This txt file I can access through windows notepad.)

Now I have to pass this data to Pro-e and want to create plot (let say) then I have to store that file in NTFS only because if I store in linux "/" file, or /home file then it will not be accessible in windows.

dmp_mech
August 21st, 2012, 06:42 AM
Mingw is one of the things I mentioned in my post, having done cross-platform development in C and GTK myself.

I think the problem really is that the files are on an NTFS partition. If you look at the output the OP provided from my ls -al request, you'll see only owner has rw permission, nobody has execute, and no other users can even see the things.

This suggests a couple of things:

- the files need to be stored in a linux partition (I prefer a subfolder off my home folder myself)

- the OP needs to be sure they own the folder

- the OP needs to be sure when they place the executable there that the executable bit is set in the permissions

As for other parts of the discussion, "filename" means any file name - like I showed in my post.

Also, if you tell us your native language we can check to see if there is/are ubuntu forum/forums in your native language as that might make it easier for you. You are doing fine with English, and I didn't mean to imply anything other that we might be able to find a native language forum for you if it would be easier for you. Sorry if what I wrote might have been misinterpreted.


It is o.k. I do not have problem about your suggestion regarding forum. Do not be sorry. My objective is to solve my problem and not language. Anyway I do not think there might be a forum in my native languages. I know 5 languages: Gujarati, Hindi, Sanskrit, Kannada, English. I am bad in grammar so please adjust with my writings. Anyway leave it and I want to say something more.

Problem is I am using other mechanical softwares like Pro-e, Catia, Mathematica etc. which run in Windows only (It may be run in Linux also but I don't have that version). For that I need some output data from executable file of C programming. Like suppose I want to plot temperature vs. time plot. Now if I write the C program and create executable file.
I can do it through following command lines:

gcc -o temperature temperature.c -lm

./temperature (this will print output in terminal only. But I want it to be stored somewhere because if I close the terminal than output will also lost. So I should not use this command.)

./temperature > temperature.txt (this will execute the temperature file and parallely will write output in temperature.txt file. This .txt file I can access through windows notepad and also through gedit.)

Here is my actual problem. Now I have to pass this data to Pro-e, matlab, mathematica etc. and want to create plot (let say) then I have to store that file in NTFS only because if I store in linux "/" file, or /home file then it will not be accessible in windows. I do not want to run executable file, which is created in linux, in to windows. But I want to run the file in linux, then want to store output in .txt file (or other extension like .dat) and want to plot or use that file in windows compatible softwares, if needed.

ofnuts
August 21st, 2012, 09:35 AM
But problem is we are using other mechanical softwares like Pro-e, Catia etc. which run in Windows only (It may be run in Linux also but I don't have that version). For that I need some output data from executable file of C programming. Like suppose I want to plot temperature vs. time plot. Now if I write the C program and create executable file.
I can do it through following command lines:

gcc -o temperature temperature.c -lm

./temperature > temperature.txt (this will execute the temperature file and parallely will write output in temperature.txt file. This txt file I can access through windows notepad.)

Now I have to pass this data to Pro-e and want to create plot (let say) then I have to store that file in NTFS only because if I store in linux "/" file, or /home file then it will not be accessible in windows.
Your problem is accessing the output data from Windows, not the code that produces it (if this code should run on Linux). Your Linux executable code can very well be kept in /home/yourid/myprog and read/write files in /mnt/windows/some/windows/directory, ie:



./temperature >/mnt/windows/c/some/windows/directory/temperatures.txt

(to be adapted to your actual mount points for your Windows partitions)

anewguy
August 21st, 2012, 10:53 AM
You would also need to watch how the lines/records in that file are deliniated versus Windows. Linux uses a different line terminator than the cr/lf used in Windows. This means that a file that you want to contain (for Windows):

abcdefg
1234567
ststjjii

Might instead look something like this in Windows when created in Linux:

abcdefg<some garbage character>1234567<some garbage character>ststjjii<some garbage character>

This would be particularly true if echoed from, for example, a shell script.

So, any program creating the data file would need to be sure that it has a definition for the line/record termination character for the OS you want to read the data in.


I am not familiar with the programs you mentioned, and I seem to remember they are geared towards engineering, etc.. As such, I don't know what kind of output your program might create with the redirect such in your example of ./temperature > temperature.txt

If, as you mention, the program is simply echoing data to the command line, then the redirect you show may indeed result in the problem I have described.

Vaphell
August 21st, 2012, 11:54 AM
the problem with newlines is easy to manage.
when going from win to linux: sed 's/\r$//' (strip \r before end-of-line), linux to win: sed 's/$/\r/' (add \r before end-of-line)
in one go:

./temperature | sed 's/$/\r/' > /dir/on/ntfs/partition/temperature.txt

ofnuts
August 21st, 2012, 06:42 PM
The 'sed' step can be replaced by a call to 'todos'

anewguy
August 21st, 2012, 09:09 PM
I understand that, but the op wanted the file to be on his ntfs partition they could feed it directly into the Windows programs. This method requires that the command be run from Linux before the file is usable in Windows. Maybe that is acceptable to the OP, but I didn't post that as I didn't think they wanted that. However, far beyond that little detail is the original questions on running the executables, where they should reside, etc..

dmp_mech
August 23rd, 2012, 06:14 AM
I solved the problem. I followed the following website.

http://www.sinarpelangi.com/how-to-set-executable-permission-at-ntfs-partition-on-linux/

It has given following steps.

sudo blkid -c /dev/null (It will list all the partitions we have. In my computer, it displays,)

sudo umount /media/partitionname

sudo mkdir /media/partitionname

sudo mount /dev/sdaX -t ntfs-3g -o uid=1000,gid=1000,umask=002 /media/partitionname

where partitionname is the name of your ntfs partition and in sdaX, X is number obtained from the first command i.e. sudo blkid -c /dev/null.

Now I can write c program, can execute in the same partition (in ntfs). Without this commands the file color was white, after using the command ls -al. But now the color is changed to green after listing it through ls -al command.

Thank you for your help.

Patadiya Dharmesh M,
AE, IISc.

dmp_mech
August 23rd, 2012, 06:38 AM
I solved the problem.
यद्यदा चरति श्रेष्ठतां तत् देवेतरो जनः स यत्प्रमाणं कुरुते लोकस्तदनु वर्तते। (गीता ३.२१)
I solved the problem. I followed the following website.

http://www.sinarpelangi.com/how-to-set-executable-permission-at-ntfs-partition-on-linux/

It has given following steps.

sudo blkid -c /dev/null (It will list all the partitions we have. In my computer, it displays,)

sudo umount /media/partitionname

sudo mkdir /media/partitionname

sudo mount /dev/sdaX -t ntfs-3g -o uid=1000,gid=1000,umask=002 /media/partitionname

where partitionname is the name of your ntfs partition and in sdaX, X is number obtained from the first command i.e. sudo blkid -c /dev/null.

Now I can write c program, can execute in the same partition (in ntfs). Without this commands the file color was white, after using the command ls -al. But now the color is changed to green after listing it through ls -al command.

Thank you for your help.

Patadiya Dharmesh M,
AE, IISc.