0

I have been working on a project for the last few months which involves me writing some scientific simulations in C++ using Visual Studio 2012 on Windows 8. I use GNU Science Library for some linear algebra and random number functions.

The program runs quite slowly on my laptop so I've been given an account that I can remote desktop too which will be able to run more quickly. I don't have admin rights to install GSL etc there and the remote desktop is on XP, so I need my .exe to work there.

So I've done what's suggested here: xxxxxx.exe is not a valid Win32 application and here: Visual Studio 2012 compile for XP - not valid win32 - v110_xp

But when I try to compile my code with the settings: Platform Toolset: Visual Studio 2012 - Windows XP (v110_xp) Code Generation - Runtime Library: /MT Linker - System - SubSystem: Console

I get errors saying:

Error 10 error LNK2005: _printf already defined in LIBCMT.lib(printf.obj) C:.....\ProjectName\MSVCRTD.lib(MSVCR110D.dll) ProjectName

Error 8 error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj) C:.....\ProjectName\MSVCRTD.lib(MSVCR110D.dll) ProjectName

Error 7 error LNK2005: _free already defined in LIBCMT.lib(free.obj) C:.....\ProjectName\MSVCRTD.lib(MSVCR110D.dll) ProjectName

Error 13 error LNK2005: _fflush already defined in LIBCMT.lib(fflush.obj) C:.....\ProjectName\MSVCRTD.lib(MSVCR110D.dll) ProjectName

Error 9 error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj) C:.....\ProjectName\MSVCRTD.lib(MSVCR110D.dll) ProjectName

and quite a few more.

I think this might be to do with what is mentioned here: How to avoid "error LNK2005:" (already defined stdlib functions) when compiling libpng with Microsoft Visual Studio '08?

So even though my project is using the right settings my GSL isn't maybe? But I'm not too sure how this all works.

Thanks for any help you can offer

Community
  • 1
  • 1
AP911
  • 1
  • 1
    you have to use the _same_ settings. There is no right or wrong. One project uses `/MDd` (dynamic debug version), the other '/MT'(static release version). Possibly gls distributes different libraries. Note you probably cannot distribute the debug version because microsoft does not offer debug redist package. – wimh Apr 18 '15 at 14:48
  • Thanks for replying. What's the best solution if I need to run the simulations from a single .exe on a computer where I don't have the ability to install gsl? Is it to use the /Mt version of gsl when I compile on my laptop? Because if that's what I need to do, I don't know how to do it at all, I tried googling "gsl static visual studio 2012" and not much comes up – AP911 Apr 18 '15 at 20:02
  • asuming gls is open source, you should be able to compile gls yourself with the settings you like. But the problem above just relates to whether you use a static or dynamic visual studio library runtime. It does not mean gls itself is also static or dynamic. – wimh Apr 19 '15 at 09:17

0 Answers0