I have two files in the same folder: myset.c, set.h My makefile looks like this: myset:myset.c set.h     gcc -ansi -pedantic -Wall myset.c -o myset  When I run the command make in the console it shows the following error: fatal error: set.h: No such file or directory  in myset.c I wrote: #include &lt;set.h&gt;  What is the problem?
3559
In the C and C++ programming languages, what is the difference between using angle brackets and using quotes in an include statement, as follows?   #include &lt;filename&gt;  #include "filename"
51505
In the process of learning tinyos I have discovered that I am totally clueless about makefiles.  There are many optional compile time features that can be used by way of declaring preprocessor variables.  To use them you have to do things like:  CFLAGS="-DPACKET_LINK"        this enables a certain feature.  and    CFLAGS="-DPACKET_LINK" "-DLOW_POWER" enables two features.  Can someone dissect these lines for me and tell me whats going on? Not in terms of tinyos, but in terms of makefiles!
75158
At the end of a makefile I saw   rm -f *~ *.class   I understand the *.class, but what's *~?
120897
Say I have three files (template_*.txt):   template_x.txt template_y.txt template_z.txt   I want to copy them to three new files (foo_*.txt).    foo_x.txt  foo_y.txt  foo_z.txt   Is there some simple way to do that with one command, e.g.   cp --enableAwesomeness template_*.txt foo_*.txt
50656
I am working on some C++ files all of which are in a single folder.   When I do ls both the .cpp and the .h files show up in the same colour.   Is there a way to tell the bash shell that I want to display .cpp files in pink and .h files in golden-brown?
42422
It's my second post here, i have a huge problem which prevents me to study so i have to fix it as soon as it's possible ! My gcc was working fine and i had to work on FairThreads (in C). I downloaded the following archive :  As you can see, in /src there's a makeFile, i replaced the second line which was : LIB_DIR     = ../lib  by LIB_DIR     =  /usr/bin/ld and i compiled the makeFile by the command &quot;make&quot; And now, i cannot compile any c/c++ program anymore. Even a hello world program. I got the following error message on the terminal for every compiling attempt : /usr/bin/ld: 2: /usr/bin/ld: Syntax error: newline unexpected collect2: error: ld returned 2 exit status  I have found on the net this solution but it doesn't work for me : sudo apt-get autoremove binutils     sudo apt-get install binutils  I also tried to reinstall gcc, when executing : sudo apt-get purge gcc   i got : Des erreurs ont été rencontrées pendant l'exécution :   linux-firmware   linux-image-generic-hwe-18.04   linux-generic-hwe-18.04 E: Sub-process /usr/bin/dpkg returned an error code (1)  but when i trie a gcc --version it tells me that it is not found. So when i execute the command to reintall it : sudo apt-get install gcc   i also get : Des erreurs ont été rencontrées pendant l'exécution :  linux-firmware  linux-image-generic-hwe-18.04  linux-generic-hwe-18.04  linux-image-5.4.0-72-generic  initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)  but gcc --version tellls that it's installed. Finally, when i trie to compile a program, i got : /usr/bin/ld: 2: /usr/bin/ld: Syntax error: newline unexpected collect2: error: ld returned 2 exit status  I hope that i explained well, and i'll get a solution for this :/, as a computer science student, i can't do anything without gcc :( EDIT 1 : When i try to remove bin/ld by executing : sudo rm -fr /usr/bin/ld;sudo apt-get install --reinstall binutils  i got : Des erreurs ont été rencontrées pendant l'exécution :  linux-firmware  linux-image-generic-hwe-18.04  linux-generic-hwe-18.04  linux-image-5.4.0-72-generic  initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)  and this particular error message : WARNING: no ldd around - install libc-bin  EDIT : I have installed ldd by the command : sudo apt-get install libc-bin  still no changes...
34127
I have multiple files in multiple folders under one directory that need to be in one folder. Is there a command line that can help me accomplish this?
39916
Observation: I have an executable named foo, located in /b/foo. It is compiled against an old header of a dynamic library, causing it to segfault when executed:  $ foo Segmentation fault. // Expected behaviour.   Now, I compile a new version of foo to /a/foo against the new dynamic library that should execute just fine. Directory a/ is in my $PATH before b/, so /a/foo should be selected:  $ which foo /a/foo   When I execute foo, the following happens:  $ foo Segmentation fault.   Therefore, it seems that /b/foo gets executed, whereas "which" tells me that /a/foo should be executed. To make things weirder, when I run the full path $(which /a/foo), things run fine:  $ /a/foo OK!  $ cp /a/foo . $ ./foo OK!     To go yet one step further, if I now delete /a/foo:  $ rm /a/foo   Then /b/foo must surely be chosen, right?  $ which foo /b/foo $ foo bash: /a/foo: No such file or directory $ $(which foo) Segmentation fault. // Expected result.   Nope!  Fix: Source .bash_profile and .bashrc and the problem disappears.  Reproducibility: Every time. Just remove /a/foo, source ~/.bash_profile, create /a/foo, and the above observation re-occurs.  Question: Does anyone have an idea what went wrong here?  Hypothesis: "which" is up-to-date, but the system chooses based on "what was used to be the case". In my example above, /a/foo did not yet exist when the terminal was opened: I had only just created it. Therefore, when /a/foo was created, "which" did detect /a/foo, but the system still chose /b/foo, because it was somehow out of sync? But why is the system out of sync?
97411
I want an easy way to create multiple directories in C++/Linux.   For example I want to save a file lola.file in the directory:   /tmp/a/b/c   but if the directories are not there I want them to be created automagically. A working example would be perfect.
50816
I am trying to learn C++, but I can't even make the first (hello world) example from cplusplus.org work with g++ command or c++. I created a file just like the example and ran g++ myfile, then ./myfile.  I get a permission problem, then I use chmod +x myfile and the permission problem is gone but this problem happens:  gzuspower@gzuspower:~/Desktop$ ./4 ./4: line 1: //myfirst: No such file or directory ./4: line 4: syntax error near unexpected token `(' ./4: line 4: `int main ()'   I called my file 4 because it is my 4th attempt. This is on Xubuntu 16.04.The duplicate question answer did not work i tried .c ,.cpp ,as file extension and tried firstc++ (my first attempt file) instead of 4(my fourth attempt file) and nothing works. i'm going to try different form of hello-world code.
41932
When ever I save a gedit file in a directory, two copies of it get saved with identical content. Ex: If the gedit file is named as file_name and saved in Home directory then when u ls the Home directory you get file_name and file_name~ in the list. When the file command is run against them I get ASCII text, with very long lines for both of them when I view their contents using the less command they seem to largely contain identical content. The ~ file is a copy of the file when it was saved for the penultimate time. Can someone please help me in understanding as to why such a file (the file with a trailing ~ mark in its name ) is created?
82565
When I try to compile it says  sh: 1: /media/user/Linux/test/bin/Debug/test: Permission denied   I did not have this problem with Ubuntu 12.10   I have just started to use Ubuntu so....
56659
I was wondering how to make a file named as a flag, e.g., if I wanted to make a folder named -a, what commands would do the trick?   I tried mkdir '-a', mkdir \-a, and neither worked. I'm on Ubuntu.
3595
Do I have to do any configuration to start brace expansion? When I run mkdir {1..10}, it just creates a dir naming {1..10}.
52830
I need to build a list of files present in a directory but also pass in a file containing a list of directories to exclude.  I've seen the below suggestion but I've had no luck with it when it comes to the type flag:  find $dir_name $(printf "! -name %s " $(cat $exclude_file))   Is there a way I can do it or will I need to create the entire list and then work through it removing ones that partially match ones in the exclude directory.
69585
Is it possible to copy a single file to multiple directories using the cp command ?  I tried the following , which did not work:    cp file1 /foo/ /bar/ cp file1 {/foo/,/bar}   I know it's possible using a for loop, or find. But is it possible using the gnu cp command?
82685
I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it.  Visual Studio tells me that it can't find a particular header file. I found the file in the source tree, but where do I need to put it, so that it will be found when compiling?    Are there special directories?