Russian Qt Forum
Апрель 17, 2024, 00:10 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
 
  Начало   Форум  WIKI (Вики)FAQ Помощь Поиск Войти Регистрация  

Страниц: [1]   Вниз
  Печать  
Автор Тема: Заблудился с zlib (MSVC 2012)  (Прочитано 5017 раз)
Igors
Джедай : наставник для всех
*******
Offline Offline

Сообщений: 11445


Просмотр профиля
« : Май 19, 2013, 20:46 »

Добрый день

Есть 2 статические либы, каждая по неск файлов .lib и у каждой "свой" zlib. Конечно 2 zlib включаться в 1 проект не желают, вякает так:
Цитировать
Zlib.lib(deflate.obj) : error LNK2005: _deflate_copyright already defined in zlibstat.lib(deflate.obj)

Однако оставить только одну не выходит
Цитировать
1>IlmImf.lib(ImfZipCompressor.obj) : error LNK2019: unresolved external symbol _compress@16 referenced in function "public: virtual int __thiscall Imf::ZipCompressor::compress(char const *,int,int,char const * &)" (?compress@ZipCompressor@Imf@@UAEHPBDHHAAPBD@Z)
1>IlmImf.lib(ImfPxr24Compressor.obj) : error LNK2001: unresolved external symbol _compress@16
1>IlmImf.lib(ImfZipCompressor.obj) : error LNK2019: unresolved external symbol _uncompress@16 referenced in function "public: virtual int __thiscall Imf::ZipCompressor::uncompress(char const *,int,int,char const * &)" (?uncompress@ZipCompressor@Imf@@UAEHPBDHHAAPBD@Z)
1>IlmImf.lib(ImfPxr24Compressor.obj) : error LNK2001: unresolved external symbol _uncompress@16
или так (если отключаю другую)
Цитировать
1>IFXLocalImageTools.lib(cifxlocalimagetools.obj) : error LNK2019: unresolved external symbol _compress2 referenced in function "private: int __thiscall CIFXLocalImageTools::CompressImageZlib(void *,struct STextureSourceInfo *,void * *)" (?CompressImageZlib@CIFXLocalImageTools@@AAEHPAXPAUSTextureSourceInfo@@PAPAX@Z)
1>IFXLocalImageTools.lib(cifxlocalimagetools.obj) : error LNK2019: unresolved external symbol _uncompress referenced in function "private: int __thiscall CIFXLocalImageTools::DecompressImageZlib(void *,struct STextureSourceInfo *,void * *)" (?DecompressImageZlib@CIFXLocalImageTools@@AAEHPAXPAUSTextureSourceInfo@@PAPAX@Z)
Исодники одной либы у меня есть, другой нет

Что предпринять?

Спасибо
Записан
vregess
Гость
« Ответ #1 : Май 19, 2013, 21:30 »

Можно попробовать создать 2 DLL библиотеки. Навроде
fake1.cpp + static_lib1 + zlib1 - > lib1.dll
fake2.cpp + static_lib2 + zlib2 - > lib2.dll

fake*.cpp может опционально предоставлять интерфейс для работы со static_lib*.

Либо одну линковать статически, а из другой (для которой есть исходники) создать DLL.
Записан
thechicho
Гость
« Ответ #2 : Май 20, 2013, 10:11 »

Цитировать
Linker Tools Error LNK2005

symbol already defined in object

The given symbol, displayed in its decorated form, was multiply defined.

Tips

One of the following may be a cause:

The most common cause of this error is accidentally linking with both the single-threaded and multithreaded libraries. Ensure that the application project file includes only the appropriate libraries and that any third-party libraries have appropriately created single-threaded or multithreaded versions.


The given symbol was a packaged function (created by compiling with /Gy) and was included in more than one file but was changed between compilations. Recompile all files that include the symbol.


The given symbol was defined differently in two member objects in different libraries, and both member objects were used.


An absolute was defined twice, with a different value in each definition.
This error is followed by fatal error LNK1169.

Цитировать
The problem is that one of the two projects is using Multi-threaded DLL while the other is using Multi-threaded (without DLL in it) in Project Properties -> Configuration Properties -> C/C++ -> Code generation.

Happened to me several times.

Make sure to "synchronize" that setting even for release builds, and for each possible combination (debug, non debug, etc)

Цитировать
In the project properties for ALL projects, check that they all use the same runtime type: either DLL or static

This can be found under Project Properties -> C/C++ -> Code Generation -> Runtime Library. Make sure you have the Release x64 build selected.

The particular value isn't very important (in terms of compile errors) but they should all be the same
Записан
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  


Страница сгенерирована за 0.046 секунд. Запросов: 23.