Thread: Compiling in windows

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    15

    Compiling in windows

    Hello people. Have been trying to convert ".c" (C) to object ".o". But i'd like being able to convert them to any other format, from ".i"(preprocessing), to ".exe" manually, passing step by step all the compiling process. I'd like to do it two ways.
    1. Using only the compiler DevCpp uses (i don't know what ".exe" exactly is the compiler there are many executables in DevCpp\bin (make.exe, mingw32-c++.exe, mingw32-g++.exe,.. here it's a list http://inst.eecs.berkeley.edu/~instc...ler/index.html. So could you tell me what program should I use?

    2. I like to know how to do it not depending on DevCpp, but once I know point 1, i supose that doing it DevCpp will make it easier, so how could I, from a blank source code file saved as .c, tell the program I want to compile it not the default .exe but object for example? Thanks.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,334
    gcc is the compiler.

    Dev-C++ has, under options->compiler, a place for you to specify flags, just as if you were on the command line.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    15
    Hi again task I've open a shell, and in the c:\dev-cpp\bin directory (where gcc.exe is) i write
    Code:
    gcc "c:\documents and settings\kikn\desktop\try.c" -o hello.exe
    , and the shell seems to do something (for a second it turns laggy), but no message and no hello.exe appear. I've browsed it in DevCpp directories and in desktop but no results found :S Any idea?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,334
    Are you looking for hello.exe on your desktop? Because it won't be there -- it will be in your bin directory where you ran the command from.

  5. #5
    Registered User
    Join Date
    Dec 2008
    Posts
    15
    Yes, i've looked in bin, and all other DevCpp directories, and in desktop but hello.exe isn't there.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,334
    If you got no message, then your executable file was built.

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    15
    Yeah the problem was i didn't write the name so it was created as "a.exe". Well, so this means I don't need DevCpp anymore? just Mingw32 and a notepad? This way i could program even in my mobile phone

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    IDE just makes life (arguably) easier. It's certainly possible to go without an IDE.

    I don't use an IDE myself, either (Make + GCC works well for me), but my largest projects so far are just a few thousand lines. I'm probably going to get an IDE for larger projects.

    (actually, I do use Code::Blocks, but I only use it as a "tabbed notepad", and do all my compiling/running/debugging on the command line)

  9. #9
    Registered User
    Join Date
    Dec 2008
    Posts
    15
    Great thanks the two. But one more question, if only make and gcc needed, (i only use gcc, what's make for?) what are all the other executables? g++.exe, c++.exe, gdd.exe.....there are about 20 maybe more in the bin directory. gcc is just 86kb do I only need that and make?

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,653
    g++ is the C++ compiler...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by kiknewbie View Post
    Great thanks the two. But one more question, if only make and gcc needed, (i only use gcc, what's make for?) what are all the other executables? g++.exe, c++.exe, gdd.exe.....there are about 20 maybe more in the bin directory. gcc is just 86kb do I only need that and make?
    Yes you'll need most of them like the C pre-processor, linker, etc

  12. #12
    Registered User
    Join Date
    Dec 2008
    Posts
    15
    Yes, but i'd really like to know each exe function. I've search everywhere but nothing, any result. Besides, i've tried g++ instead of gcc and also works with c. The only info found is throgh the link linked above

    * GCC (C, C++, Objective-C compilers) 3.2.3
    * GNU Make 3.80.0
    * GNU Debugger (gdb) 5.2.1
    * GNU Binutils (assembler, linker, etc.) 2.13.90

    And it says gcc can compile c, c++, and objective-c(don't know what is), so what's the reason of g++, and all the others? Please if you know any site where that is explained post a link. Many thanks

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,401
    Quote Originally Posted by kiknewbie
    Besides, i've tried g++ instead of gcc and also works with c.
    Not all valid C programs are valid C++ programs, so g++ might not compile a valid C program.

    Quote Originally Posted by kiknewbie
    And it says gcc can compile c, c++, and objective-c(don't know what is), so what's the reason of g++, and all the others? Please if you know any site where that is explained post a link.
    Read the GCC manual. In particular: Compiling C++ Programs.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Registered User
    Join Date
    Dec 2008
    Posts
    15
    Many thanks laser, i'm reading now but i don't understand why then gcc let us compile c++, and even specify with -x c++ command to compile c++, if there could be problems in the compilation as you link says. Same happens if we use g++ -x c to compile c with g++, why not let just gcc for C and g++ for C++?

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,401
    Quote Originally Posted by kiknewbie
    i don't understand why then gcc let us compile c++, and even specify with -x c++ command to compile c++
    Quote Originally Posted by kiknewbie
    Same happens if we use g++ -x c to compile c with g++, why not let just gcc for C and g++ for C++?
    The -x option allows for fine grained control over which language to compile the source. My guess is that using gcc instead of g++ would be a convenient way to avoid linking with the C++ library. Using g++ with -x c instead of gcc directly to compile a C program is a little strange to me, but if you do not want to use the feature, don't use it.

    Quote Originally Posted by kiknewbie
    if there could be problems in the compilation as you link says.
    I do not see any mention of potential compile problems in the manual entry that I linked to. My mention of potential compile problems has to do with using g++ to compile C programs.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling for Windows on Linux
    By Tzu in forum C++ Programming
    Replies: 9
    Last Post: 08-20-2006, 10:08 AM
  2. Network Programming in C for Windows
    By m.mixon in forum C Programming
    Replies: 7
    Last Post: 06-19-2006, 08:27 PM
  3. Compiling for Windows CE
    By LiX in forum Windows Programming
    Replies: 1
    Last Post: 12-06-2004, 08:53 AM
  4. compiling gaim for windows
    By the Wookie in forum C++ Programming
    Replies: 8
    Last Post: 10-05-2003, 06:12 AM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM