#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    boston ma
    Posts
    1
    Rep Power
    0

    telnet c++ execute problem


    hi i'm new here and new to c++ (only 2 classes deep).

    i am using windows 2000 and i need to connect to my schools unix computer ( SunOS 5.8) via telnet.

    when i connect and write my program i hit Ctrl+x+c to save.
    Then i hit g++ (filename) to check my program.
    after i do that i recive the message.

    "ID: Fatal: file (filename) unknown file type
    ID: Fatal: file processing errors. No output written to a.out
    collect2: ld returned 1 exit status

    any ideas because i'm stumped heres my first program.


    #include <iostream>

    using namespace std;

    int main ()
    {
    cout<<"Welcome to c++ programming"<<endl;
    return 0;
    }

    if i were at school i can save compile and execute but, from home i can just save and i really need to check my work.
    thanks guys
    j
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    Two things:
    1. The thread title is inaccurate. You are not having a problem with telnet, but rather with running g++. The title should reflect that.
    2. When you post code, use code tags. They are like HTML tags, only with square brackets [] . The keywords in the tags at the start and end of the code are "code" and "/code" (not including the quotation marks). This will retain the code's indentation and keep it readable. If your code is hard to read, people are less inclined to help, so always try to make it easier for us to help.


    The problem may be in how you are invoking g++.

    If the source file's name is welcome.cpp, then the command to compile it should be:
    g++ welcome.cpp

    If you forgot to include the extension, then it would not be able to find the file.

    Also, as I recall (since I never do otherwise), you must use an extension that g++ recognizes as being a C++ source file; otherwise it will not recognize the file type (which appears to be the case, judging by the error message).

    A final note: UNIX is case-sensitive about everything! If you saved the file as Welcome.cpp and tried to compile it as welcome.cpp, it wouldn't work because those are two entirely different filenames. It's not that way in DOS, but it is in UNIX.

    Hope that helps. BTW, you can copy and paste in the command prompt window (which is where telnet runs in Win2k). With the mouse highlight what you want to copy, then right-click on the window's title bar and a menu will appear. Under the Edit option you will find copy and paste options. The window also has a scroll bar so you can scroll back to an earlier line.

    Here's a thought: you should have ftp capability with the school computer. Connect with ftp instead of with telnet. Your username and password should be the same with ftp as with telnet. Enter help for the list of commands. If you do a dir, then you will get a list of the files in your home directory. ascii places it in ASCII mode for file transfers (binary is for binary files). get will download a file and put will upload. bye will log you off and disconnect.

    Now the only problem is that DOS/Windows uses a different end-of-line sequence (CR LF) than UNIX does (LF). There are utilities for converting back and forth, but they are third-party and not standard. If you are successful with ftp, then you might want to ask the instructor about it. This way, you could work on the program off-line and then upload it, convert it, and finish it up on-line. I once knew how to do a global replace command for vi to remove the extraneous carriage returns (CR == ^M == 0x0d), but I've forgotten it.
    Last edited by dwise1_aol; September 18th, 2003 at 08:37 PM.

IMN logo majestic logo threadwatch logo seochat tools logo