Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 850 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run C Programs under Linux Ubuntu.

#1
I have posted this in My Forums, So I think that the Info must be Shared, the same reason I posted it Here, all the Credits originally goes to Coded32, that is Me.


So, here is Coded32.
Today I am gonna Teach you something different.
Maybe that you are using Windows 7 and finding it difficult to compile your C Programs under x64 Versions and you may use DoxBox Emulator, But that does sux. In my opinion the whole Windows Operating system sux, so If you wanna go to the deeper to the programming grounds, you need a OS that fully supports something outta Programming.

Note : If you need to stick to Windows [Not Recommended for Programmers], Try "Pellas C Compiler" for Windows 7, that even runs and compiles under x64 versions, or try Doxbox.
Doxbox commands. You should have the Turbo C compiler installed beforehand.


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


The above code will Mount C drive as the default drive under which the execution takes place [change the drive according to your TC{Turbo C} Installation files.].
Now we go to the C: drive, find the Dir, and go under TC [The default location{folder name} for Turbo C compiler]., we then go to bin under TC where the TurboC executable file lies !.
and then it automatically prompts the editor. Done.

Now here is the Interesting part, most of the users may now turn to use linux as their Guide and I suggest that is the right choice :tongue: Okay first to compile your programs, you need to find the Terminal. The Terminal is equivalent to the command prompt in Windows, with more extra exclusive features. Find the terminal in Applications [View the tor left corner], go to "Accessories" , find Terminal and start it.

Now type the following : [Don't say that Coded32 teaches you half Lesson's ! ] Get a Net connection to update the C libraries.


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


It will Install all the Updates for the Ubuntu package, you have. I have used Ubuntu 9.10 as my Version [Karmic].

Then Get the C package that will run effectively under Linux ! Type the following !:--

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


That will install the essential files needed to execure, run, and compile the C programs you create under Linux.
Okay after that....type the following :


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Where "sudo' is a r00t command in Linux. gedit is a default text editor in Ubuntu. coded32.c or whatever is the filename that you want to create and compile, it can be any filename but make sure you give the ".c" extension, because it is C programming if you have not forgotten.
Then it will open the editor --> a Text based... Type your program there, as this is the first program under linux you are gonna try, i will make the code simple. Type in the editor as follows.


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Ok, now click the "Save" button so it saves under the current bash directory, I will tell about "Bash" later as that is not the business right now :smile: However proceed as follows.
Go the terminal [That is already opened], type :--


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

cc is the package here, more on that later. -c means the "compile' command". And replace the "coded32.c" with whatever the filename you give !
Ok, we successfully compiled a program, if you get any errors post here and i will solve. But now we have to get the Object file, If you dunno what is OOP language and what does "Object Linking" means, you need to seriously get a ebook on C or read your college notes !

Now type the following to link a Object, that should be created under the very dir you are in.


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


-o is the "Link Object" command. Remember don't copy/paste this commands, manually do it and replace the "coded32.c" with whatever you have as your filename.
A executable will will be obtained this way and now to run your program, do the following !--:


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Replace the "coded32.c" with your filename.
That's all and you will get the output.
I hope you do the same and stick to Linux for better programming, IDE packs do the same but it looks Kid works to me :tongue: Coded32 here , seeya later !
Reply

#2
Actually, I like more to use Eclipse under Linux, it compiles using same commands but automatically + you have a nice IDE. (Be sure to get eclipse for C/C++)
you should be able to get it by: apt-get install eclipse

Nice guide btw!!!
Reply

#3
Quote:(07-03-2011, 05:29 PM)1llusion Wrote:

[To see links please register here]

Actually, I like more to use Eclipse under Linux, it compiles using same commands but automatically + you have a nice IDE. (Be sure to get eclipse for C/C++)
you should be able to get it by: apt-get install eclipse

Nice guide btw!!!

Thank you.
I wrote this for the geeky purpose that linux users use. :lol:
Reply

#4
Quote:(07-08-2011, 05:39 PM)Coded32 Wrote:

[To see links please register here]

Thank you.
I wrote this for the geeky purpose that linux users use. :lol:

Its great guide :smile: I just don't like to program in command line, because I'm learning and therefore I like to know the errors right away
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through