+ 1

How can I run my c++ codes in Linux using GCC ??

Como puedo correr mis códigos de c++ en Linux usando GCC??

1st Mar 2020, 10:31 PM
Esteban Chacon Martín
Esteban Chacon Martín - avatar
13 ответов
+ 1
Hi to run the code you should have installed C/C++ compiler like as GCC v7.4.0 if you already got an older version you can update it following the next link: https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/, the errors you received are linker errors, not compiler errors. try using this flag at the end -lstdc++ for example: gcc -Wall -Wextra -Werror -pedantic strings.cpp -lstdc++ -o strings dont worry about the -W flags you can compile without them but is better practice use them
4th Mar 2020, 4:43 AM
Juan Guillermo CC
Juan Guillermo CC - avatar
+ 7
This command will create a file named a.out: g++ filename.cpp To run the file, use: ./a.out As mentioned by Taste, you can also use -o to specify the filename, and then run it using; ./filename
1st Mar 2020, 11:04 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
in c++ ? g++ sourcecode.cpp is fine, and the output will be sourcecode.exe or sourcecode.out if you want to control the output g++ sourcecode.cpp -o output
1st Mar 2020, 10:38 PM
Taste
Taste - avatar
+ 3
It's not your opinion, it will still not be for general-purpose either people like it or not. Kali has made it clear that the OS is for pentesters only, and that it has not been tested for general-purpose. I never said it fits general use, and I also agree with Martin. But one of the major reasons Kali wasn't recommended to beginners is because of security risks or single-root-user. With that gone, the only problem with Kali is bugs. Other than that, Linux is Linux.
3rd Mar 2020, 3:03 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Martin Taylor I just wanted to let you know that the link you provided is not updated. Kali Linux recently removed the "single root user" rule in the latest 2020.1 release, which means that it can now be run without root privileges at all, just like any other distro. This also means that it became more suitable to developpers who like to use it as their main os, even if not for pentesting. The only disadvantages of the new version is bugs, as it has not been tested for general purpose use.
3rd Mar 2020, 9:54 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Martin I did not say I use Kali as my main OS, nor did I recommend anyone to use it. I am simply saying that Kali Linux can now be ran without the single-root-user as it has always been, and it clearly was only done because some users - who are not pentesters - tend to use it as their daily life OS. Taste I think they removed the option to live boot in 2020.1, but I am not sure.
3rd Mar 2020, 2:48 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
yeah, last time i use kali linux was for pentest training. and i choose to use live usb, i mean.. why would anyone want 300+ tools that may not be used at all in the system ?
3rd Mar 2020, 2:44 PM
Taste
Taste - avatar
+ 1
i was learning about 3 or 4 years ago, kali mini was still a thing.. for learning standpoint though, kali is great dont get me wrong. i still would like to use it, but imo its very specialized distro and doesnt really fit with general use as Martin Taylor said. maybe it just me, but having a bunch of tools that i rarely or never use at all on my system kinda annoys me *staring at visual studio*
3rd Mar 2020, 2:58 PM
Taste
Taste - avatar
0
Now I have another question for everyone :) , why the iostream package is returning errors when I compile with gcc, My system by the way is Kali Linux 2017...
2nd Mar 2020, 3:55 PM
Esteban Chacon Martín
Esteban Chacon Martín - avatar
0
Thanks for the answer, the others people are fighting for which OS is better or not T_T , I use Kali Linux cause I like to look for all Open Source codes in there, for study purpose, also I which to raise my knowledge about security , I am using C++ now cause that is the language I study in the university...
4th Mar 2020, 1:18 PM
Esteban Chacon Martín
Esteban Chacon Martín - avatar