mlabbe / nativefiledialog

A tiny, neat C library that portably invokes native file open and save dialogs.
zlib License
1.78k stars 209 forks source link

Linker error (64 bit build) #21

Closed christianclavet closed 8 years ago

christianclavet commented 8 years ago

Hi, I've done a build of the project in 64bit.

When I build the project with the files, it compiles but fail to link. The examples are fine, so I must do something wrong.

I tried adding to my project the nfd.h header and/or only using include, they generate the same error.

The compiler generate the code in C++ in my project.

Here is the output of my console when I try to build it (MSVC 2015, Windows 10):

1>LINK : warning LNK4098: conflit entre la bibliothèque par défaut 'MSVCRT' et les autres bibliothèques ; utilisez /NODEFAULTLIB:library 1>nfd.lib(nfd_win.obj) : warning LNK4217: symbole défini localement stdio_common_vsprintf_s importé dans la fonction sprintf_s 1>nfd.lib(nfd_common.obj) : warning LNK4217: symbole défini localement free importé dans la fonction NFD_PathSet_Free 1>nfd.lib(nfd_common.obj) : warning LNK4217: symbole défini localement malloc importé dans la fonction NFDi_Malloc 1>nfd.lib(nfd_win.obj) : error LNK2019: symbole externe non résolu imp_strncat référencé dans la fonction "enum nfdresult_t cdecl AddFiltersToDialog(struct IFileDialog ,char const )" (?AddFiltersToDialog@@YA?AW4nfdresult_t@@PEAUIFileDialog@@PEBD@Z) 1>nfd.lib(nfd_common.obj) : error LNK2019: symbole externe non résolu imp_strncpy référencé dans la fonction NFDi_UTF8_Strlen 1>../../IRB_Model_D.exe : fatal error LNK1120: 2 externes non résolus ========== Régénération globale : 0 a réussi, 1 a échoué, 0 a été ignoré ==========

mlabbe commented 8 years ago

This is likely your code generation set to the wrong runtime library.

Rebuild nfd to match code generation for the build configuration you are linking it with. (ex: Multithreaded DLL).

christianclavet commented 8 years ago

Thanks! I've just read about this. I'll do a double check. I did not know that other libs that are compiled with MSVC should not have different settings in their runtime library. I'll do a double check and report, but it must be it. I already have 2 libs linked in my application and they work fine.