Linking third-party VC library to MDL application

Hi,

I need help in linking a third-party libraries created in VS2005.

I need to use some functions in MyLibrary.lib, but have link message and error


MyLibrary.lib(MyLibrary.obj) : warning LNK4075: ignoring '/EDITANDCONT
INUE' due to '/INCREMENTAL:NO' specification
LINK : error LNK1218: warning treated as error; no output file generated



Code in cpp file:

#include <MyLibrary.h>

...

Process();

 

Code in MyProject.mke file

DLM_LIBRARY_FILES     =    $(mdlLibs)BentleyDgn.lib    \
                        $(mdlLibs)toolsubs.lib        \
                        $(mdlLibs)ditemlib.lib        \
                        $(mdlLibs)mdlbltin.lib         \
                        $(mdlLibs)mdllib.lib        \
                        $(baseDir)MyLibrary.lib

 

What is wrong? How as a principle, is linked to the library to not MDL in MDL application?

 

Thanks, Point

 

  • You are using a Bentley make file to build a C++ DLL. The bmake rules invoke the Microsoft C++ compiler and the Microsoft linker.

    Your makefile is correctly instructing the Microsoft linker to use your .lib. However, it looks like you compiled that library using an option that is incompatible with the current build.

    The Microsoft linker gives you a warning about an option, but the default mode of that linker is to treat a warning as an error.

    Either rebuild your library without the offending option, or modify the Microsoft linker's default behaviour.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Hi Point,

    The EDITANDCONTINUE switch is used to specify that the application can be modified during run-time without having to stop and rebuild your application (i.e. : the modifications will be applied immediatly).

    If you want that functionality for your library you might try to set /INCREMENTAL:YES and your makefile and rebuild your application.

    HTH,

    Mathieu



  • Thanks, it is really true.

    when I changed compiler options in my library about this message error was removed. But now I have another error

    fatal error C1007: unrecognized flag '-typedil' in 'p2'

    LINK : fatal error LNK1257: code generation failed

    To Mathieu St-Pierre, how must I change make file? I don`t undestartd where put /INCREMENTAL:YES in make file.

     

    I do not want to start a new post. The similary problem with window librarians directly. In this case I have next compiler errors

    error C2065: 'LSTATUS' : undeclared identifier
    error C2146: syntax error : missing ';' before identifier 'status'
    error C2065: 'status' : undeclared identifier

     

    cpp file:

    #include <Winreg.h>

    ...

        WCHAR arr[1024] = {0};
        DWORD dwSize = sizeof(arr)/sizeof(arr[0]);
        DWORD dwType;
        LSTATUS status = ::RegGetValueW(HKEY_CURRENT_USER,L"Software\\MySoftware",L"Path",RRF_RT_ANY,&dwType,arr,&dwSize);
        if(status!=ERROR_SUCCESS){
            return;
        }

     

    mke file:

    DLM_LIBRARY_FILES     =    $(mdlLibs)BentleyDgn.lib    \
                            $(mdlLibs)toolsubs.lib        \
                            $(mdlLibs)ditemlib.lib        \
                            $(mdlLibs)mdlbltin.lib         \
                            $(mdlLibs)mdllib.lib        \
                            Advapi32.lib

     

    LSTATUS defined in Winreg.h.

    Why compiler did not see the standard Windows file? What should I do?

    Thanks, Point.

     

     

  • 
    error C2065: 'LSTATUS' : undeclared identifier
    error C2146: syntax error : missing ';' before identifier 'status'
    error C2065: 'status' : undeclared identifier
     …
    LSTATUS status = … 
    

    The compiler is telling you that it doesn't understand the type LSTATUS. Because it doesn't understand that type, the variable status that you declare becomes an undeclared identifier.

    Where does type LSTATUS originate? That function is documented as returning a LONG …

    
     RegGetValue Function
    
    Retrieves the type and data for the specified registry value.
    
    LONG WINAPI RegGetValue(
      HKEY hkey,
      LPCTSTR lpSubKey,
      LPCTSTR lpValue,
      DWORD dwFlags,
      LPDWORD pdwType,
      PVOID pvData,
      LPDWORD pcbData
    );
    

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Thanks, Jon. All works.

    The thing is that I have installed both VS2005 and VS2008. And I used the source code from VS2008.

  • I copied the RegGetValue documentation from MSDN 2008. It returns a LONG.

    So, where does LSTATUS originate?

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • I saw it in header file of 2008 headers. But it differents from VS2005.

    Regards, Point.