linking problems

This is a discussion on linking problems within the C++ Programming forums, part of the General Programming Boards category; having trouble with my code when i build it, i get some linking errors i have no idea what they ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    84

    linking problems

    having trouble with my code when i build it, i get some linking errors i have no idea what they mean

    as far as i know all the libary files that are needed are present for the project, its only WS2_32.LIB that i need anyway i think

    Code:
    mesagesend.obj : error LNK2001: unresolved external symbol "void __cdecl disconnectfromserver(int)" (?disconnectfromserver@@YAXH@Z)
    mesagesend.obj : error LNK2001: unresolved external symbol "int __cdecl connecttoserver(unsigned short,char const *)" (?connecttoserver@@YAHGPBD@Z)
    client___Win32_Debug/client.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    any ideas anyone?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    what is the compiler your using?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    84
    visual studio 6

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    84
    bumpy, please help

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,742
    It can't find the functions you posted here
    passing function problem

    If you have multiple source files, you need to make sure that all your source files are in the project.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    May 2002
    Posts
    84
    i have included all the header files i need in the main, and the .lib files i need

    i can't see any i have missed

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,742
    It's not enough to include a header file containing
    [code// this is say connecting.h
    ]int connecting::connecttoserver(unsigned short port, const char *servername); // a prototype[/code]
    you also need the source code as well.
    Code:
    // this is say connecting.cpp
    int connecting::connecttoserver(unsigned short port, const char *servername) {
      // body
    }
    The compiler needs the header file (via #include) in order to be able to call the function.

    The linker (which generated those errors) needs the actual code. Actual code is found in the compiled objects of other source modules you wrote, other libraries you wrote or other libraries other people wrote.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ OpenGL linking problems
    By KoshiB in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2006, 05:25 PM
  2. Linking problems, class problems
    By Kheila in forum C++ Programming
    Replies: 12
    Last Post: 11-22-2005, 01:47 AM
  3. Linking problems trying to compile QT application
    By Maragato in forum C++ Programming
    Replies: 1
    Last Post: 08-19-2005, 10:08 PM
  4. Grrr.... SDL Linking Problem
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-12-2005, 09:44 PM
  5. More linker problems
    By Ganoosh in forum C++ Programming
    Replies: 4
    Last Post: 07-12-2005, 11:27 PM

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