Thread: Project type for linux

  1. #1
    Registered User MoonMan's Avatar
    Join Date
    Nov 2011
    Posts
    19

    Project type for linux

    What type of program do I have to compile the code as to run it on Ubuntu? Like how I have to do a console application for Windows, what is the equivalent for linux? Thank you!

  2. #2
    spaghetticode
    Guest
    Your search term is "cross-compiling". I am not familiar with cross-compiling, but be prepared that it will be a little more complicated a process than just configure your IDE to simply "compile for linux". I do not believe that's possible. Btw, please tell us what IDE under which operating system you are using next time.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    if you expect to build something on windows and run it on linux, you've got a steep road ahead of you. like dennis.cpp says, it's called cross-compiling, and it is possible, but there are a lot of things to set up with your tool chain to make it happen.

    if you're talking about building on linux, then that's a different story altogether, and becomes much easier. whichever IDE you choose will determine what type of project you want to build. most IDEs have a lot of project options to choose from, so you should be able to choose the best one for the project you're working on. if you are confused, tell us what you want to do, and what IDE you're using, and we can possibly make a suggestion.

  4. #4
    Registered User MoonMan's Avatar
    Join Date
    Nov 2011
    Posts
    19
    I'm sorry I am new to all of this so I apologize if my question was worded wrong/doesn't make sense.. So, programs written in C++ for windows have to be written a completely different way to be ran in linux? Will it possibly work if I use Wine to load the program from linux?

    I am going to be gone for a month and the only computer I am going to have has linux on it, so just trying to figure out how I can continue to practice programming with that computer..

    Thanks for all the help and sorry for all the confusion!

    Edit: I think the answer to the IDE question is: Codeblocks 10.05 with mingw? Hehe let me know if this was not the right answer you were looking for..
    Last edited by MoonMan; 12-13-2011 at 01:57 PM.

  5. #5
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    ....You're approaching it in the wrong way here.
    You do not have to run windows exe `s on Linux.
    Just install codeblocks there and compile it....you'll have gcc instead of mingw...but they are same.

  6. #6
    spaghetticode
    Guest
    Hm. Okay, with your second post, *now* I am confused. Let's try and sort this out.

    1. Standard C++ is designed to be platform independent, in a sense that code you write can be compiled without any changes on every platform where a standard conforming compiler is available. I.e., if your code is standard C++, you don't have to rewrite it for linux, but it has to be *compiled* again under linux. (Or, as said before, cross-compiled under Windows, which is a complicated process.)

    2. I am not familiar with Codeblocks, so I'm not sure what it does when creating a "windows console application" project. It might be just a standard text based C++ project; in that case, nothing else needs to be done under linux. It might as well be a kind of project that uses certain Windows specific libraries; in that case, you won't be able to use it under linux. Check your Codeblocks documentation for that.

    3. Codeblocks is available under linux too, so no need to switch IDEs. Mingw is a Windows port of gcc, the most widely spread compiler under linux; with linux Codeblocks you might want to use gcc.

    Were these the answers you were looking for? If not, don't hesitate to ask again.

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by MoonMan View Post
    Edit: I think the answer to the IDE question is: Codeblocks 10.05 with mingw? Hehe let me know if this was not the right answer you were looking for..
    Codeblocks runs on linux, and "mingw" (minimal gcc for windows) is a windows port of gcc, which is the compiler on ubuntu (and the default on linux generally).

    Ie, you're in luck. It probably works better on linux, since it uses the same native libraries as everything else.
    Last edited by MK27; 12-13-2011 at 03:44 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    Registered User MoonMan's Avatar
    Join Date
    Nov 2011
    Posts
    19
    I understand now! Thank you all so much for your help...I would have been so confused without you guys/gals!!

  9. #9
    spaghetticode
    Guest
    I know that feeling. Windows confuses me too everytime I use it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux Automation project.
    By John Erlandsson in forum Linux Programming
    Replies: 12
    Last Post: 09-09-2011, 06:06 AM
  2. The project type is not supported by this installation
    By puk284 in forum C# Programming
    Replies: 8
    Last Post: 11-19-2008, 09:27 AM
  3. Windows/Linux C++ project
    By TriKri in forum Linux Programming
    Replies: 7
    Last Post: 01-01-2007, 06:13 PM
  4. Project Type for DOS Application
    By Visual Develope in forum C++ Programming
    Replies: 8
    Last Post: 05-06-2002, 02:37 PM