You are not logged in.

#1 2013-10-25 17:06:07

killedbymonkeys
Member
Registered: 2013-08-26
Posts: 17

[SOLVED] g++ issue

Hello,

g++ produces not executable executables.
I can compile and run Ardour, which is wirtten in c++, but when i try to compile:

main.cpp

#include <iostream>
using namespace std;

int main ()
{
        cout << "this was a test\n";
        return 0;
}

it compiles. Then i try to execute but i get:
sudo: unable to execute ./a.out: Permission denied

EDIT

i forgot: i can use the same code/commands on my laptop and it works fine

Last edited by killedbymonkeys (2014-03-20 15:17:53)

Offline

#2 2013-10-25 17:14:09

beidl
Member
Registered: 2013-08-31
Posts: 6

Re: [SOLVED] g++ issue

chmod +x a.out

...

Offline

#3 2013-10-25 17:16:44

killedbymonkeys
Member
Registered: 2013-08-26
Posts: 17

Re: [SOLVED] g++ issue

that would be easy big_smile but no its already 755 and i'm the owner

Offline

#4 2013-10-25 20:31:59

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] g++ issue

Will you please post the command you use to compile that source code?

Do the bad computer and good computer both run Arch Linux x86_64? (Just wondering)

...and what's up with the "sudo"? I think that's the tricky part here... What the heck, please post your sudo config too. tongue

Offline

#5 2013-10-25 20:59:38

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,723
Website

Re: [SOLVED] g++ issue

Also, what filesystem is a.out on, and what options is it mounted with?

Drop the sudo. You don't need root privileges to say hello world.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2013-10-25 21:16:22

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: [SOLVED] g++ issue

check if your filesystem is mounted with the "noexec" option with the mount command.

Offline

#7 2013-10-25 22:02:50

killedbymonkeys
Member
Registered: 2013-08-26
Posts: 17

Re: [SOLVED] g++ issue

its on my root partition with ext4 filesystem.
/etc/fstab:
UUID=2f85b33e-e5cf-40b8-b863-e8c6c634d077               /             ext4          discard,rw,relatime,data=ordered    0 1


I tried sudo because it original said it had no permission, i know it doesn't make sense. But I just tried smile

The command i used is:
g++ main.cpp

And yes both systems run Arch x86_64.

Offline

#8 2013-10-25 22:04:43

killedbymonkeys
Member
Registered: 2013-08-26
Posts: 17

Re: [SOLVED] g++ issue

Okay its solved. I had a NAS share from a third arch system mounted there. Thanks a lot for your help.

Offline

#9 2013-10-25 22:10:22

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,723
Website

Re: [SOLVED] g++ issue

Good to hear. Glad we helped to set you on the right track. smile

Remember to mark your topic as [SOLVED] by editing the title in the first post.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB