I have a file called inmap.cpp that I need to compile on the server, this creates another file called a.out, anyone any ideas how I might do this?
1# I placed the inmap.cpp file in the public_html folder
2# I logged into the server from terminal with ssh
3# I ran gcc -lm inmap.cpp
The output is as follows:
root@ms1 [~]# gcc -lm inmap.cpp
gcc: inmap.cpp: No such file or directory
root@ms1 [~]#
I tried moving it into the main directory also, the one that is called by my ip address and contains the folders: public_html. .cpanel-datastore, mail, tmp, public_ftp etc. and did the same from there but got the same result. I guess this is because I need to get to another directory, like the one the file is in but how do I get there, I am not much up on working with command lines.
I ssh'd to the domain where the file was placed and then logged in using root and the root password for the server.
Would someone mind explaining 'step by step' as to how I would compile this file?
Thanks
Compile a .cpp file on linux server
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Code: Select all
cd /path/to/cpp/file
g++ inmap.cpp -o a.outMy biggest problem was not knowing how to get around linux using ssh 'or anything for that matter' or what to do when I got there. I just found this really great linux site about half an hour ago that has answered some of the basics I have been trying to find out for ages but without success:
http://www.comptechdoc.org/os/linux/use ... asics.html
putting half an hours reading along with your reply to my post got me sorted.
Thanks
BTW, This is a really useful link for any Linux newbe out there that doesn't know his right from his left. I learnt more about linux and linux commands in half an hour from this site than I have in all my reading of bits and peices on the internet for weeks.
http://www.comptechdoc.org/os/linux/use ... asics.html
putting half an hours reading along with your reply to my post got me sorted.
Thanks
BTW, This is a really useful link for any Linux newbe out there that doesn't know his right from his left. I learnt more about linux and linux commands in half an hour from this site than I have in all my reading of bits and peices on the internet for weeks.