How to link library in visual studio

19,751

Solution 1

According to the website:

DO NOT add smile.lib as additional linker input in project settings - smile.h takes care of that.

I imagine that means the smile.h file already includes:

#pragma import smile.lib

Can you check if this is the case?

Solution 2

use #pragma comment to add library or use project settings (linker->input)

Share:
19,751
Malo
Author by

Malo

Updated on June 04, 2022

Comments

  • Malo
    Malo almost 2 years

    I'm trying to create a project in c++ with the SMILE library (http://genie.sis.pitt.edu/index.php/downloads). On the site I downloaded the Visual Studio 2010 / VC 10.0 SP1 version for x64 (I have windows 7 and visual studio 2010 installed). After create a new project, I went to the project properties->configuration->C/C++->directory of additional inclusions and set the path of the folder that contains the library. When I try to compile Iget the error:

    1>------ Inizio compilazione: Progetto: IDSS_2013, Configurazione: Debug Win32 ------
    1>  stdafx.cpp
    1>  AssemblyInfo.cpp
    1>  IDSS_2013.cpp
    1>  Generazione del codice in corso...
    1>  .NETFramework,Version=v4.0.AssemblyAttributes.cpp
    1>LINK : fatal error LNK1104: impossibile aprire il file 'smile_dbg.lib'
    ========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========
    

    The source is the one provided with the example in the documentation:

    #include "smile.h"
    
    #include <stdio.h>
    
    void CreateNetwork(void);
    void InfereceWithBayesNet(void);
    void UpgradeToInfluenceDiagram(void);
    void InferenceWithInfluenceDiagram(void);
    void ComputeValueOfInformation(void);
    
    int main()
    {
     CreateNetwork();
     InfereceWithBayesNet();
     UpgradeToInfluenceDiagram();
     InferenceWithInfluenceDiagram();
     ComputeValueOfInformation();
     return(DSL_OKAY);
    };