Thread: problems compiling in gcc

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    1

    problems compiling in gcc

    Hi guys i need some help
    I make a program in c and i compile the program in Linux with gcc. The programs good right. Then i prove the .exe of Linux at Windows and it doesn't work. When i click at the .exe in windows the computer open a ms-dos window and don't do anything. I prove the .exe at the console of windows and it doesn't work.
    Anybody have an idea how resolve this problem compiling in gcc of Linux.

  2. #2
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    I don't think I'm alone here, so I'll be blunt - WHAT???

    Please describe your problem more clearly.
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  3. #3
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    What exactly do you mean by 'prove'?

    Please expand on how it ''doesn't work''
    Last edited by twomers; 09-03-2006 at 04:58 PM.

  4. #4
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    hmmm... Are you saying you compiled a C program under linux, and then tried to open the resulting executable under Windows?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Post your code and the error message(s), or at least a better description than "doesn't work".
    If you're referring to the console window appearing and disappearing quickly, well that's in the FAQ.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Register User andor's Avatar
    Join Date
    Aug 2006
    Location
    Novi Sad
    Posts
    42
    Do you have cygwin in windows? If no then install it and run in windows the .exe (./your_exe) as you should in Linux.

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Linux and Windows executables are completely different, and it's very difficult to get one to run on the other. You need to re-compile your program for windows. One way to do so is to use cygwin, a port of bash to windows: it can compile most Linux text-based programs. (If you're program is ANSI compatible you can compile it with just about any compiler, such as the free compiler Dev-C++ that many members of this board use: http://bloodshed.net/devcpp.html).
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc problems with Fedora Core 3
    By phldml3 in forum C Programming
    Replies: 4
    Last Post: 06-11-2005, 12:34 AM
  2. problems compiling
    By dnr72 in forum C Programming
    Replies: 3
    Last Post: 01-17-2005, 04:29 PM
  3. Singleton problems
    By techrolla in forum C++ Programming
    Replies: 16
    Last Post: 01-02-2005, 04:05 PM
  4. CC and GCC compiler problems
    By gayomard_mehta in forum Linux Programming
    Replies: 3
    Last Post: 12-07-2004, 03:49 PM
  5. Problems with GCC
    By Maragato in forum Linux Programming
    Replies: 4
    Last Post: 08-02-2004, 06:04 PM