Find the answer to your Linux question:
Results 1 to 4 of 4
I am a relative novice at programing but I have and can write simple things. I've been using microsoft visual studio express on windows for a while to create simple ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    4

    my binary doesn't do anything.

    I am a relative novice at programing but I have and can write simple things.
    I've been using microsoft visual studio express on windows for a while to create simple terminal "dos-prompt" apps for my self on windows. Now I am now running Debian Linux. I have spent several hours trying to figure out how to build something in Linux I tried apt-getting a few ide's and so on. Finally i decided to try to just write code into a text file and use g++ to compile it. So to test it and just figure it out how it works I wrote a simple few lines hoping that I could at least get someting to cout into the terminal. This is what I worte:

    #include<iostream>
    int main(void)
    {
    std::cout << "this tests make";
    return 0;
    }

    I compiled it by typing "g++ -o test tmake.cpp

    this seems to have worked it didn't output any errors and after a few seconds it returned a prompt. I assume it compiled the program. but wanted to be sure so I added some errors and tried to recompile which gave me error messages. I was satisfied that my program was being compiled so I returned the program to it's original state and recompiled again with no errors. Now I have a binary file however if I try to open it noting happens. Am I doing something wrong? or is my code bad or what,? I've been searching for an answer and trying things for several hours to no avail.

  2. #2
    Linux User
    Join Date
    Oct 2004
    Location
    /dev/random
    Posts
    404
    You need to run your program as
    Code:
    ./test
    Replace test with whatever your binary name is.

    The program looks ok, no problems with it whatsoever.
    The Unforgiven
    Registered Linux User #358564

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Smile

    Quote Originally Posted by gkffjcs View Post
    I am a relative novice at programing but I have and can write simple things.
    I've been using microsoft visual studio express on windows for a while to create simple terminal "dos-prompt" apps for my self on windows. Now I am now running Debian Linux. I have spent several hours trying to figure out how to build something in Linux I tried apt-getting a few ide's and so on. Finally i decided to try to just write code into a text file and use g++ to compile it. So to test it and just figure it out how it works I wrote a simple few lines hoping that I could at least get someting to cout into the terminal. This is what I worte:

    #include<iostream>
    int main(void)
    {
    std::cout << "this tests make";
    return 0;
    }

    I compiled it by typing "g++ -o test tmake.cpp

    this seems to have worked it didn't output any errors and after a few seconds it returned a prompt. I assume it compiled the program. but wanted to be sure so I added some errors and tried to recompile which gave me error messages. I was satisfied that my program was being compiled so I returned the program to it's original state and recompiled again with no errors. Now I have a binary file however if I try to open it noting happens. Am I doing something wrong? or is my code bad or what,? I've been searching for an answer and trying things for several hours to no avail.
    why you want to open binary file instead of executing it?
    binary files won't have useful info to read
    try and run your binary file....for outputs
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  4. #4
    Just Joined!
    Join Date
    Jun 2007
    Posts
    4
    Thank you much. That was helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...