compiling c

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Cysign

compiling c

Post by Cysign »

I installed mint for practicing basic c skillz. I'm used to use gcc or cc to compile and source-file to an executive. But gcc and cc don't report any errors during toe compilation, the executive file is created but when I try to execute it, nothing happens.
Any idea what I do have to change?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Cysign

Re: compiling c

Post by Cysign »

I figured out it's the missing "PATH=$PATH:." I had to place in my .bashrc in Ubuntu. But I can't find any bachrc-file in linuxmint. Where should I search?

If I start my compilated file with ./filename it works :)
Cysign

Re: compiling c

Post by Cysign »

I could only find /etc/bash.bashrc ....but that one doesn't seem to work :/
Rua
Level 3
Level 3
Posts: 159
Joined: Sat Sep 17, 2011 11:09 am
Location: Netherlands

Re: compiling c

Post by Rua »

Adding the current directory '.' to your path is usually not a good idea for security reasons. The 'proper' alternative is to type './' before the name of the program you want to run. So if your program is called 'hi' then type: ./hi

The reason for this is that scripts and other programs will often try to use standard system utilities like ls, cp and so on. But there is no rule that says you can't create another program called cp. Normally, you can distinguish the two because when you type 'cp' you use the real cp, and './cp' runs the other program. If you add '.' to your path, this distinction is not made anymore, and you or a malicious program or user can create another program called 'cp', and make the programs on your system think it's the real cp when it's not.
Locked

Return to “Other topics”