linker error:(

This is a discussion on linker error:( within the C++ Programming forums, part of the General Programming Boards category; Code: hello!..i am new to c++ programming...I hav turbo c++ installed on my comp...whenever i include <iostream.h> i get linker ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    1

    Unhappy linker error:(

    Code:
    hello!..i am new to c++ programming...I hav turbo c++ installed on my comp...whenever i include <iostream.h> i get linker error...all c programs are working...
    i jus did a "hello world" program and saved it as v.cpp
    #include<iostream.h>
    main()
    {
    cout<<"hello world";
    }
    
    linker error:undefined symbol _cout in the module v.cpp
    linker error:undefined symbol ostream::operator<<(long) in module v.cpp
    
    
    can any 1 please tel me what i should do?..
    i actually copied the turbo c++ compiler from my friends comp....all c++ programs are working on her comp but not on mine....but c progs are working....
    
    
    thanx in advance...

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,941
    Your test code is incorrect. I suggest testing with:
    Code:
    #include <iostream>
    int main()
    {
        std::cout << "hello world\n";
    }
    i actually copied the turbo c++ compiler from my friends comp
    That might be a bad idea, it depends on how the compiler is supposed to be installed. Especially if this is an old version of the compiler, you might want to just change to a newer and more standard conformant compiler such as the MinGW port of g++ or the compiler that comes with Microsoft Visual Studio 2005 or 2008 Express.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,793
    main()
    Is not valid in C++. All functions must return a type.
    I would follow on laserlight's advice and get a better IDE. Here's some free ones: http://cpwiki.sf.net/Integrated_Development_Environment

    You should also include <iostream>, not <iostream.h> and use std::cout.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21