[CMake] Linking Error with Visual Studio 2013 x64

Jakub Zakrzewski jzakrzewski at e2e.ch
Thu Apr 17 08:38:53 EDT 2014


>> Visual Studio doesn't work like a good gcc?

Good joke. ;)

>> Is there some option to export automatically some methods without using __declspec(dllexport)?

No. There are workarounds like in http://stackoverflow.com/questions/225432/export-all-symbols-when-creating-a-dll but it's too much work.
Basically you want to define a macro that resolves to __declspec(dllexport) when building the DLL and to nothing when only using libraries headers.

--
Gruesse,
Jakub


-----Original Message-----
From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Romain Leguay
Sent: Donnerstag, 17. April 2014 14:27
To: Nils Gladitz; cmake at cmake.org
Subject: Re: [CMake] Linking Error with Visual Studio 2013 x64

Visual Studio doesn't work like a good gcc? Because, I try this code with mingw (32 and 64) and it's working perfectly.
Is there some option to export automatically some methods without using __declspec(dllexport)?

Romain

Le 17/04/2014 12:03, Nils Gladitz a écrit :
> On 17.04.2014 11:46, Romain Leguay wrote:
>>
>> I think I found a bug with CMake 2.8.12.2: I have on project with two
>> sub-folders: a SHARED library and an executable that use the library.
>> When I generate the Visual Studio solution, my application want to 
>> link with a static version of my library.
>>
>> I join you a very small project to illustrate this bug.
>>
>
> I haven't tried to build the project but I am guessing that the 
> "static version" of the library is actually the import library:
> http://en.wikipedia.org/wiki/Dynamic-link_library#Import_libraries
>
> And that you are missing DLL exports e.g.:
>     http://msdn.microsoft.com/en-us//library/a90k134d.aspx
>
> Without any exports the linker does not create an import library for 
> your DLL.
>
> Nils

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list