# Symmetryextension build failure with Visual Studio

**URL:** <https://discuss.avogadro.cc/t/symmetryextension-build-failure-with-visual-studio/2252>\
**Category:** Development\
**Created:** [September 29, 2015, 10:33am UTC](https://discuss.avogadro.cc/t/symmetryextension-build-failure-with-visual-studio/2252 "2015-09-29T10:33:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwao\_aoyama](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/i/54ee81/32.png) [@iwao\_aoyama](https://discuss.avogadro.cc/u/iwao_aoyama)\
**Post date:** [September 29, 2015, 10:33am UTC](https://discuss.avogadro.cc/t/symmetryextension-build-failure-with-visual-studio/2252/1 "2015-09-29T10:33:14Z")

</div>

Hello

I tried to build the latest version Avogadro Win32 binaries from github  
master sources which downloaded on September 15 with Visual Studio 2013  
(Visual C++ 12) on Windows 10 as follows.

I rewrited cmake generater specification from “NMake Makefiles” to “Visual  
Studio 12 2013” in the script/cmake-msvc2008.bat script,  
and then generated Visual Studio solution file “avogadro.sln” with targets  
project files (vcxproj files).

Since msym were written by using VLA, I switched the platform toolset  
specification of msym.vcxproj property dialog from “Visual Studio  
2013(v120)”(default) to “LLVM-vs2013” (using clang 3.7 for Windows).

Compilation of avogadro projects progressed smoothly,  
but the build of target symmmetryextension.dll was failed.

The failure was this dll link error with msym.lib in which some codes called  
unknown \_snprintf function.  
(error LNK2001: unresolved external symbol"\_snprintf":  
msym.lib(point\_group.obj), msym.lib(symop.obj)  
msym.lib(msym\_error.obj), msym.lib(orbital.obj),  
msym.lib(elements.obj),msym.lib(context.obj) )

I think this is due to the discordance between that msym calls C functions  
and that symmetryextension calls C++ functions.  
I am wondering if is there the way to build…

Thanks in advance.

iwao

---

<div class="post-metadata">

**Author:** ![Marcus\_Johansson](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Marcus\_Johansson](https://discuss.avogadro.cc/u/Marcus_Johansson)\
**Post date:** [September 29, 2015, 6:42pm UTC](https://discuss.avogadro.cc/t/symmetryextension-build-failure-with-visual-studio/2252/2 "2015-09-29T18:42:11Z")

</div>

Unfortunately I can’t have a look at this right now since I’m in Canada,  
and I don’t have any computer.

I’d suggest testing putting this at the top of msym.h

#ifdef WIN32

#define snprintf \_snprintf

#endif

You might need to encapsulate that in an #ifndef \_\_cplusplus

The extern “C” really should take care of this, but I suspect it’s linking  
the msym objects to the c++ libraries even though it shouldn’t, but windows  
also has some weird behaviour when it comes to some posix functions.

/M  
On Sep 29, 2015 12:33, “iwao aoyama” [iwao.aoyama@gmail.com](mailto:iwao.aoyama@gmail.com) wrote:

> Hello
> 
> I tried to build the latest version Avogadro Win32 binaries from github  
> master sources which downloaded on September 15 with Visual Studio 2013  
> (Visual C++ 12) on Windows 10 as follows.
> 
> I rewrited cmake generater specification from “NMake Makefiles” to “Visual  
> Studio 12 2013” in the script/cmake-msvc2008.bat script,  
> and then generated Visual Studio solution file “avogadro.sln” with targets  
> project files (vcxproj files).
> 
> Since msym were written by using VLA, I switched the platform toolset  
> specification of msym.vcxproj property dialog from “Visual Studio  
> 2013(v120)”(default) to “LLVM-vs2013” (using clang 3.7 for Windows).
> 
> Compilation of avogadro projects progressed smoothly,  
> but the build of target symmmetryextension.dll was failed.
> 
> The failure was this dll link error with msym.lib in which some codes  
> called  
> unknown \_snprintf function.  
> (error LNK2001: unresolved external symbol"\_snprintf":  
> msym.lib(point\_group.obj), msym.lib(symop.obj)  
> msym.lib(msym\_error.obj), msym.lib(orbital.obj),  
> msym.lib(elements.obj),msym.lib(context.obj) )
> 
> I think this is due to the discordance between that msym calls C functions  
> and that symmetryextension calls C++ functions.  
> I am wondering if is there the way to build…
> 
> Thanks in advance.
> 
> iwao
> 
> * * *
> 
> * * *
> 
> Avogadro-devel mailing list  
> [Avogadro-devel@lists.sourceforge.net](mailto:Avogadro-devel@lists.sourceforge.net)  
> [avogadro-devel List Signup and Options](https://lists.sourceforge.net/lists/listinfo/avogadro-devel)

---

<div class="post-metadata">

**Author:** ![iwao\_aoyama](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/i/54ee81/32.png) [@iwao\_aoyama](https://discuss.avogadro.cc/u/iwao_aoyama)\
**Post date:** [September 30, 2015, 10:39am UTC](https://discuss.avogadro.cc/t/symmetryextension-build-failure-with-visual-studio/2252/3 "2015-09-30T10:39:03Z")

</div>

Hi Marcus

Thank you for quick reply.

I added the suggested code:

#ifdef WIN32  
#define snprintf \_snprintf  
#endif

at the top of msym.h and msym\_error.h.

The previous link error has been resolved!

Thank you so much!

iwao

---

<div class="post-metadata">

**Author:** ![Marcus\_Johansson](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Marcus\_Johansson](https://discuss.avogadro.cc/u/Marcus_Johansson)\
**Post date:** [October 28, 2015, 1:58pm UTC](https://discuss.avogadro.cc/t/symmetryextension-build-failure-with-visual-studio/2252/4 "2015-10-28T13:58:34Z")

</div>

Hi

A new version of libmsym is available, which can generate SALCs for point groups Ci, Cs, Cnv, Dn, Dnh, Dnd, Td, O and Oh  
We’re using avagadro v1 to visualise them by converting them to an fchk file right now.

Once there is VTK surface rendering of orbitals and atom selection in avogadro v2 I’ll try to integrate the SALC generation into the symmetry plugin.  
That way students can select a basis (like 4f-orbitals) for an element, visualise the SALCs they would produce and see their irreps and partner functions.

(also has types python 3 bindings)

cheers,  
/M
