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.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to build a big project step by step. I'm working on Linux and using qt-creator and gcc compiler. I include a set of related files in the .pri file and then build, test functionality and then add a new set of existing files and so on.
The project compiled successfully then I included a folder containing some header files then when compiled I got many errors in libc-header-start.h, string.h, cpu-set.h, time.h and many other stdlib and system files. Errors like missing binary operator before token (, unknown type name __cpu_mask, expected ';', ',' or ')' before '*' token.
I think these are likely to be preprocessor errors that are caused, for example, if I forget a semicolumn or so, right?
My question is, how can I locate the exact location in the header/source files where all these errors started, for example, the line of code where the semicolumn is missing.
This answer is just collecting the comments on my question.
Here is what can help locating what is the root cause of preprocessor errors:
Make sure that the names of your header files don't conflict with standard header files.
Check the first file in the errors list. Check where this file is included. If this file is included by another standard header file, check where the parent header file is included in your code. The root cause of the errors may be in the lines before that #include statement in your code. For example, you may have forgetten a semi-column before this #include.
Use gcc -H file.c to check all the header files included with file.c.
Use gcc -E file.c to generate a preprocessed version of file.c, then you will have the full end picture of your file which you can then investigate.
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.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Using Vim as an editor, I wrote the following simple code in C and saved it as helloworld.c :
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
}
In command prompt, I wrote:
start chrome helloworld.c
This caused my browser to open up the file, but it did not print Hello World. Instead, it just displayed the code I had written. Did I not save it as a C file?
Also, I was wondering how to display the result of my C program inline on command prompt, as I am fairly new to it. While searching the internet, I could not find any answers. Am I supposed to do so from Vim? I learned that you are supposed to do ./ in the gedit command box to display the result inline, but this does not work for the one that comes with Windows.
Please help and thank you for taking the time to read and answer.
As #Ernest Friedman-Hill has already said, you normally have to compile the program. However, there are alternatives.
One alternative is the Tiny C Compiler, from http://bellard.org/tcc/. TCC does allow you to run the program without compiling it.
tcc -run helloworld.c
Does exactly what you want.
The Tiny C Compiler is not the only way to run C code from source without compiling it first. There are a few other alternatives.
CSL: http://csl.sourceforge.net/csl.html
Ch: https://www.softintegration.com/
PicoC: https://code.google.com/p/picoc/
CINT: http://root.cern.ch/drupal/content/cint
I hope this helps.
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 (-).
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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^