User forums > General (but related to Code::Blocks)

Permission Denied though my linux chmod has allowed 777

<< < (5/7) > >>

Commaster:

--- Code: ---gcc -c pointers-addressof.c -o pointers-address-of.run
/pointers-address-of.run
bash: ./pointers-address-of.run: Permission denied
-rwxrwxrwx 1 edward edward 16624 Jun 13 14:18  pointers-addressof
-rwxrwxrwx 1 edward edward  2648 Jun 14 17:34  pointers-addressof.o
-rwxrwxrwx 1 edward edward  2648 Jun 14 17:38  pointers-address-of.run

--- End code ---
Google "GCC flags":

--- Code: ----c
    Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
    By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o.
--- End code ---
Why are you trying to run the object file instead of the compiled binary? Even the file size should hint at that...

edcompsci:

--- Quote from: Commaster on June 15, 2021, 04:36:56 am ---
--- Code: ---gcc -c pointers-addressof.c -o pointers-address-of.run
/pointers-address-of.run
bash: ./pointers-address-of.run: Permission denied
-rwxrwxrwx 1 edward edward 16624 Jun 13 14:18  pointers-addressof
-rwxrwxrwx 1 edward edward  2648 Jun 14 17:34  pointers-addressof.o
-rwxrwxrwx 1 edward edward  2648 Jun 14 17:38  pointers-address-of.run

--- End code ---
Google "GCC flags":

--- Code: ----c
    Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
    By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o.
--- End code ---
Why are you trying to run the object file instead of the compiled binary? Even the file size should hint at that...

--- End quote ---

Thanks, I'll looking at what I found looking up  "GCC flags"..may take some time to look through but I'm looking.
https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc

The compiled binary is the .run file. Please forgive the attempt at running the .o file. My analogy is it's like checking a drawer that I know nothing's in when trying to find a lost object in a household. sometimes I try that drawer anyway without any logic behind it. That's if its my drawer and my lost object.

edcompsci:
Does codeblocks use the header files found in /usr/include or some other location?  I tried giving myself ownership with +rwx permissions to all of the /usr/include/ header files but it didn't help.

Commaster:
Please stop doing what you are doing. Especially giving 777 access rights to everything, 2x especially outside your personal folders.

I provided the snippet from the google search already:

--- Code: ----c
    Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
    By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with .o.
--- End code ---

Please run the 16kb executable in the terminal, not the 2kb object file that you renamed to .run for some odd reason.

Miguel Gimenez:
Do not mess with ownerships outside your home directory.

C::B uses the paths listed in Project -> Build options -> Search directories -> Compiler tab.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version