MYSQL

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Link problem when create SSQLS

    3 answers - 5709 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Dear All,
    Using win32 C++ using Visual C++ 2005 express edition, MySQL 5.1 and
    MySQL2.2.0 on Windows xp pro to develop a network application.
    The application that I am writing uses many SSQLS that are stored in a
    separate header file Structures.h that contains all the definitions and
    user defined structures. This file is included in almost all the other
    header files and the main function file as well.
    However, I am facing a linking problem with error LNK2005 which means an
    already defined identifier whenever I create an SSQLS although I am limiting
    the redefinitions by using the following preprocessors
    #ifndef STRUCTURES_H
    #define STRUCTURES_H
    //some definitions and user defined structs are here
    sql_create_5(_ATTRIBUTES_LIST, 2, 0,
    sql_smallint_unsigned, attribute_id,
    sql_smallint_unsigned, vendor_id,
    sql_varchar, vendor_name,
    sql_varchar, attribute_name,
    sql_smallint_unsigned, type_id);
    sql_create_2(_VENDRS_LIST, 1, 0,
    sql_smallint_unsigned, vendor_id,
    sql_varchar, vendor_name);
    #endif
    I used to bypass these errors by using the command line /FRCE:MULTIPLE
    in order to allow mutiple definitions of the same identifier.
    The errors that I am getting are:
    "public: static char const * * _ATTRIBUTES_LIST::names"
    (?names@_ATTRIBUTES_LIST@@2PAPBDA) already defined in Configurations.obj
    IncomingRadiusFrame.obj : error LNK2005: "public: static char const * const
    _ATTRIBUTES_LIST::_table" (?_table@_ATTRIBUTES_LIST@@2PBDB) already defined
    in Configurations.obj
    IncomingRadiusFrame.obj : error LNK2005: "public: static char const * *
    _VENDRS_LIST::names" (?names@_VENDRS_LIST@@2PAPBDA) already defined in
    Configurations.obj
    IncomingRadiusFrame.obj : error LNK2005: "public: static char const * const
    _VENDRS_LIST::_table" (?_table@_VENDRS_LIST@@2PBDB) already defined in
    Configurations.obj
    Logs.obj : error LNK2005: "public: static char const * *
    _ATTRIBUTES_LIST::names" (?names@_ATTRIBUTES_LIST@@2PAPBDA) already defined
    in Configurations.obj
    Logs.obj : error LNK2005: "public: static char const * const
    _ATTRIBUTES_LIST::_table" (?_table@_ATTRIBUTES_LIST@@2PBDB) already defined
    in Configurations.obj
    Logs.obj : error LNK2005: "public: static char const * *
    _VENDRS_LIST::names" (?names@_VENDRS_LIST@@2PAPBDA) already defined in
    Configurations.obj
    Logs.obj : error LNK2005: "public: static char const * const
    _VENDRS_LIST::_table" (?_table@_VENDRS_LIST@@2PBDB) already defined in
    Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * *
    _ATTRIBUTES_LIST::names" (?names@_ATTRIBUTES_LIST@@2PAPBDA) already defined
    in Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * const
    _ATTRIBUTES_LIST::_table" (?_table@_ATTRIBUTES_LIST@@2PBDB) already defined
    in Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * *
    _VENDRS_LIST::names" (?names@_VENDRS_LIST@@2PAPBDA) already defined in
    Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * const
    _VENDRS_LIST::_table" (?_table@_VENDRS_LIST@@2PBDB) already defined in
    Configurations.obj
    Radius.obj : error LNK2005: "public: static char const * *
    _ATTRIBUTES_LIST::names" (?names@_ATTRIBUTES_LIST@@2PAPBDA) already defined
    in Configurations.obj
    Radius.obj : error LNK2005: "public: static char const * const
    _ATTRIBUTES_LIST::_table" (?_table@_ATTRIBUTES_LIST@@2PBDB) already defined
    in Configurations.obj
    Radius.obj : error LNK2005: "public: static char const * *
    _VENDRS_LIST::names" (?names@_VENDRS_LIST@@2PAPBDA) already defined in
    Configurations.obj
    Radius.obj : error LNK2005: "public: static char const * const
    _VENDRS_LIST::_table" (?_table@_VENDRS_LIST@@2PBDB) already defined in
    Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * *
    _ATTRIBUTES_LIST::names" (?names@_ATTRIBUTES_LIST@@2PAPBDA) already defined
    in Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * const
    _ATTRIBUTES_LIST::_table" (?_table@_ATTRIBUTES_LIST@@2PBDB) already defined
    in Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * *
    _VENDRS_LIST::names" (?names@_VENDRS_LIST@@2PAPBDA) already defined in
    Configurations.obj
    RadiusFrame.obj : error LNK2005: "public: static char const * const
    _VENDRS_LIST::_table" (?_table@_VENDRS_LIST@@2PBDB) already defined in
    Configurations.obj
    RadiusPacketValidations.obj : error LNK2005: "public: static char const * *
    _ATTRIBUTES_LIST::names" (?names@_ATTRIBUTES_LIST@@2PAPBDA) already defined
    in Configurations.obj
    RadiusPacketValidations.obj : error LNK2005: "public: static char const *
    const _ATTRIBUTES_LIST::_table" (?_table@_ATTRIBUTES_LIST@@2PBDB) already
    defined in Configurations.obj
    RadiusPacketValidations.obj : error LNK2005: "public: static char const * *
    _VENDRS_LIST::names" (?names@_VENDRS_LIST@@2PAPBDA) already defined in
    Configurations.obj
    RadiusPacketValidations.obj : error LNK2005: "public: static char const *
    const _VENDRS_LIST::_table" (?_table@_VENDRS_LIST@@2PBDB) already defined
    in Configurations.obj
    E:\RADIUS Project\Radius 5.0.0\Debug\Radius.exe : fatal error LNK1169: one
    or more multiply defined symbols found
    I wonder how you can help me to solve this issue
    Your help is much appreciated
    Regards
    Bassam
  • No.1 | | 708 bytes | |

    08/02/07, Bassam A. Al-Khaffaf <bassam (AT) palettemm (DOT) comwrote:

    The application that I am writing uses many SSQLS that are stored in a
    separate header file "Structures.h" that contains all the definitions and
    user defined structures. This file is included in almost all the other
    header files and the main function file as well.

    This doesn't look like anything to do with mysql++ it's just a C++ error.

    You have definitions of static members in your header file, which
    means they get re-defined in every translation unit which includes the
    header.

    Did you try moving the definitions of static data members to a
    Structures.cpp file.

    jon
  • No.2 | | 1524 bytes | |

    The static variables causing the errors are defined by the ssqls macros.

    See for info on how to solve the error.

    Basically, #define MYSQLPP_SSQLS_NSTATICS before all includes for
    Structures.h except one (so that you only have one definition).

    Alternatively, if you don't use the functionality that requires the static
    variables you may get away with #defining MYSQLPP_SSQLS_NSTATICS before
    including <custom.hin Structures.h (or where ever you've included it).

    Message
    From: jonathan.wakely (AT) gmail (DOT) com [mailto:jonathan.wakely (AT) gmail (DOT) com]
    Behalf Jonathan Wakely
    Sent: 08 February 2007 10:23
    To: bassam (AT) palettemm (DOT) com
    Cc: plusplus (AT) lists (DOT) mysql.com
    Subject: Re: Link problem when create SSQLS

    08/02/07, Bassam A. Al-Khaffaf <bassam (AT) palettemm (DOT) comwrote:

    The application that I am writing uses many SSQLS that are stored in
    a
    separate header file "Structures.h" that contains all the definitions
    and
    user defined structures. This file is included in almost all the
    other
    header files and the main function file as well.

    This doesn't look like anything to do with mysql++ it's just a C++
    error.

    You have definitions of static members in your header file, which
    means they get re-defined in every translation unit which includes the
    header.

    Did you try moving the definitions of static data members to a
    Structures.cpp file.

    jon
  • No.3 | | 1859 bytes | |

    I have tried with the second solution and it worked out.

    Thanks for your help

    Regards
    Bassam

    Message
    From: Matt Dargavel [mailto:matt (AT) shout-telecoms (DOT) com]
    Sent: Thursday, February 08, 2007 6:38 PM
    To: plusplus (AT) lists (DOT) mysql.com
    Subject: RE: Link problem when create SSQLS

    The static variables causing the errors are defined by the ssqls macros.

    See for info on how to solve the error.

    Basically, #define MYSQLPP_SSQLS_NSTATICS before all includes for
    Structures.h except one (so that you only have one definition).

    Alternatively, if you don't use the functionality that requires the static
    variables you may get away with #defining MYSQLPP_SSQLS_NSTATICS before
    including <custom.hin Structures.h (or where ever you've included it).

    Message
    From: jonathan.wakely (AT) gmail (DOT) com [mailto:jonathan.wakely (AT) gmail (DOT) com]
    Behalf Jonathan Wakely
    Sent: 08 February 2007 10:23
    To: bassam (AT) palettemm (DOT) com
    Cc: plusplus (AT) lists (DOT) mysql.com
    Subject: Re: Link problem when create SSQLS

    08/02/07, Bassam A. Al-Khaffaf <bassam (AT) palettemm (DOT) comwrote:

    The application that I am writing uses many SSQLS that are stored in
    a
    separate header file "Structures.h" that contains all the definitions
    and
    user defined structures. This file is included in almost all the
    other
    header files and the main function file as well.

    This doesn't look like anything to do with mysql++ it's just a C++
    error.

    You have definitions of static members in your header file, which
    means they get re-defined in every translation unit which includes the
    header.

    Did you try moving the definitions of static data members to a
    Structures.cpp file.

    jon

Re: Link problem when create SSQLS


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "MYSQL"

EMSDN.COM