Where to get ubuntu source code?

Programming in Ubuntu (C,C++), Codelite , Code:Blocks ....?

  • OS- Linux Ubuntu 11.10 IDE - Codelite - Code:Blocks I have recently switched from windows to linux so this could be a very simple problem which i am not aware of. My IDE on windows used to output an exe which then could be executed to result in the program functioning and visble on screen just like it should. However this is not the case on my ubuntu IDE's , i know my source codes are fine as for now i have been programming very simple arithmetic programs to see if they save as programs rather than just source code (see below for code) #include <iostream> #include <cstdlib> #include <cstdio> using namespace std; int main (int nNumberofArgs , char* pszArgs[] ) { int celsius; cout << "Enter Celsius:"; cin >> celsius; int factor; factor = 212 - 32; int fahrenheit = factor * celsius/100 + 32; cout << "Fahrenheit Value is:"; cout <<fahrenheit << endl; cin.get(); return 0; } This code will build, compile and run with ease in my IDE (Codelite in Ubuntu) , however i want to be able to save this as an executable program rather than just C, C++ code . At the momoent my IDE outputts cpp. and what seems to be the equivelent version linux exe (purple-ish diamond as icon) but this icon does not have any response when i try to open/run the file ***** So how can i make my projects save as functioning executable programs rather than just source code which opens in txt editor???? ***** i know this might seem very simple to others however due to my very recent switch to linux i am not aware of what could be the problem , help would be much appreciated. Cheers

  • Answer:

    Let's say your program is myprog.cpp. It should compile to the program myprog, no exe extension. Linux uses the Executable and Linking format (ELF) rather than the exe format. Thus as a command line junkie ("bash prompt, bash prompt") I would type "g++ -o myprog myprog.cc" (cc being the extension I give c++ files). Or in a Makefile I would type: myprog: myprog.o <TAB> g++ -o myprog myprog.o myprog.o: myprog.cc <TAB>g++ -c myprog.cc Look up tutorials on make and gdb. You really don't need an ide like codeblocks. Oh,, and from a command prompt your $PATH variable doesn't include the current directory. That means you would have to type ./myprog to run it. That's how you program in Linux.

jplatt39 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Unlike windows world, in unix when a c program is compiled it creates a file with name a.out which will be executed. We can have execuable file with different name also. No need of extension EXE

James Bond

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.