How would I go about solving the "multiply defined symbols found"

186 views Asked by At

I am attempting to compile an application using source code from the early 2000s, I have mimicked the development environment however when it comes to compiling this one application called "xserver", I cannot seem to get past "fatal error LMK1169: one or more multiply defined symbols found." with it telling me that the file is the project I'm working on, very helpful. Luckily, the project I'm compiling isn't very large so I believe have determined the source file causing the issue.

#include "floop.h"
#include "ftext.h"
#include "fvid.h"
#include "fxfm.h"
#include "faudio.h"
#include "fpadio.h"
#include "fdraw.h"
#include "frenderer.h"
#include "fperf.h"
#include "dx/fserver.h"
#include <xtl.h>
#include <XbDm.h>

static BOOL _ServerInit(void *pParameter)
{
//  floop_EnableGovernor( TRUE );
    return TRUE;
}

static void _ServerTerm( FLoopTermCode_t nTermCode, void *pParameter )
{

}

static BOOL _ServerMain( BOOL bExitRequest, void *pParameter )
{
    return !bExitRequest;
}

int main(int argc, char *argv[])
{
    fang_Init();
        
    //Fang_ConfigDefs.pszFile_MasterFilePathName = "d:\\mettlearms_xb.mst";

    if (!fang_Startup())
    {
        // Trouble starting up Fang...
        OutputDebugString( "Could not start up Fang :(\n" );
        DmReboot( DMBOOT_WARM );
        for(;;);
    }

    if (!fserver_GraphicsStartup())
    {
        DEVPRINTF("failed graphics\n");
        DmReboot( DMBOOT_WARM );
        for(;;);
    }

    FPerf_nDisplayPerfType = FPERF_TYPE_NONE;

    fserver_SetTakeover(TRUE);

    floop_InstallGameloop(_ServerInit, _ServerMain, _ServerTerm, 0, 60, 15);

    DmReboot(DMBOOT_WARM);
    for(;;);

    return 0;
}

Any suggestions or tips would be extremely appreciated! ❤ Here's the build log it spits out

Compiling...
main.cpp
Linking...
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _printf already defined in LIBC.lib(printf.obj)
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _fflush already defined in LIBC.lib(fflush.obj)
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _free already defined in LIBC.lib(free.obj)
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _malloc already defined in LIBC.lib(malloc.obj)
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _tolower already defined in LIBC.lib(tolower.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
.\Release/xserver.exe : fatal error LNK1169: one or more multiply defined symbols found
2

There are 2 answers

0
VPGxxx On

Problem solved. Was mixing different runtime lib types.

2
MaAlonsoA On
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

Are you mixing different runtime library types?