Specific executable file name creates syntax error in C [closed] - c

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I'm creating a project and I need to call my executable file name "cluster".
I created a makefile and as long as I call my executable file name by any name other then "cluster" and runs it, it works fine.
However, when I'm calling the file name "cluster" -> make all -> executing (with the name "cluster") I receive the following error:
The error message
What could be the cause of this error? I must be able to call the executable file name that specific name.

If you are on linux, type
which cluster
You will probably find a program called cluster on your path. To execute the one you have made, either change the name to something like Cluster or
./cluster testGraph8 outputfile
The ./ uses the one in the current directory.

Related

problem with c about issue with clang 7 error? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Picture of code
I have a problem with clang 7 error, I don't know what the issue is? Why is clang -o hello hello.c not working? I have already tried twice and the error repeated itself so I am unsure why the clang -o hello hello.c is not working.
Read the messages. The clang command told you:
/usr/bin/ld: cannot open output file hello: Is a directory
The “/usr/bin/ld:” part says the specific program “/usr/bin/ld” (which is the linker; it links object files into an executable file) is giving you this message.
The “cannot open output file hello” part says it cannot output the file named “hello”.
The “Is a directory” part says why there is a problem: “hello” is a directory, meaning it exists and is a directory, not a regular file, so it cannot be opened like a regular file. The linker wants to open it as a regular file so that it can write to it.
To fix this, either remove or rename the directory named “hello” (check what is in it first, to see if you want it) or use a different output file name in the clang command.

How can I print file path in C inside Minix OS? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have to edit the exec syscall inside the Minix OS, in a way that every process created by it should print the program file path + program name:
for example, if I type ls inside the terminal, the next line should show me path/to/ls/ls
always in this format: filepath/programName.
I already managed to print the program name, but I am having problems with the file path. Can somebody show me how can I print it?
here is the code for sys_exec.c:
#include "syslib.h"
#include "stdio.h" //I included this library
int sys_exec(endpoint_t proc_ep, vir_bytes stack_ptr, vir_bytes progname,
vir_bytes pc, vir_bytes ps_str)
{
/* A process has exec'd. Tell the kernel. */
message m;
m.m_lsys_krn_sys_exec.endpt = proc_ep;
m.m_lsys_krn_sys_exec.stack = stack_ptr;
m.m_lsys_krn_sys_exec.name = progname;
m.m_lsys_krn_sys_exec.ip = pc;
m.m_lsys_krn_sys_exec.ps_str = ps_str;
//edited by me
puts((char*)progname);//this prints the program name
return _kernel_call(SYS_EXEC, &m);
}
and some image as reference:
this is what happens when I type ls
I was on the wrong path, the file I needed to edit was \usr\src\minix\minix\servers\vfs\exec.c, I was trying to edit \usr\src\minix\minix\lib\libsys\sys_exec.c.
Inside the right file I had access to a variable called fullpath inside the get_read_vp function. I imported stdio.h and then typed printf("executing: %s\n", fullpath); inside the function.

Check If Non Exiting File Is Excutable -Win32 C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am trying to check if file that i want to create is executable.
The check will be by given file path, for example:
c:\good.txt
I want to check if file is executable before I will create it.
I think to use this function:
with the SHGFI_USEFILEATTRIBUTES flag, but I can't use this flag with the SHGFI_EXETYPE flag.
It means that I can't use the SHGFI_EXETYPE flag on a non exiting file.
Is there any another way to check if file is executable before I create the file?
A file that does not exist cannot be ether executable or non-executable. The executability of a file (or otherwise) is stored within its metadata, be that a filename, permission bits, attributes or whatever. A file that does not exist has none of those, and hence you cannot check for its executability.
You'll notice that the SHGetFileInfo function to which you refer is document thus:
Retrieves information about an object in the file system, such as a file, folder, directory, or drive root.
Note the bit about it retrieving information about an object in the file system (not 'an object not in the file system).
A file which doesn't exist is not executable. You're asking a question which doesn't make sense. 'How hot is the water in this empty glass?' - how can something which doesn't exist have a property?

gcc: –Wall: No such file or directory (In C) [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
The command line that I'm suppose to compile my program is:
gcc –Wall –o prs process.c
I'm getting these errors:
gcc: –Wall: No such file or directory
gcc: –o: No such file or directory
gcc: prs: No such file or directory
I'm sure that I'm in the correct directory. It works when I use gcc process.c and it runs perfectly.
My prof requires us to use that command line to compile, so I don't think I should change the compile command.
– is an en dash, which GCC is interpreting as a filename.
You need to use a regular hyphen (-).

GCC link a directory [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I want compile a .c script with the gcc-compiler.
But i need to link a file and a directory. I need to link the file python3.lib and the directory D:\Python33\include.
But the linker doesn't work, here my code:
gcc main.c -lpython3 -l D:\Python33\include
The Error:
main.c:1:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
What is wrong? Thank you for help!
You are passing wrong parameters to gcc.
gcc main.c -L /path/to/lib/file/directory -lpython3 -I D:\Python33\include
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^

Resources