Partio compilation issues in Visual Studio 2015

66 views
Skip to first unread message

Anthony Kavassis

unread,
Jun 15, 2018, 3:46:41 AM6/15/18
to partio-discuss
Hi,

During compilation of Partio sources in Visual Studio 2015 there were errors generated in the following files in relation to min and max not found:

BGEO.cpp
PDB.cpp
PTC.cpp
ZIP.cpp

error C2039: 'min': is not a member of 'std'
error C3861: 'min': identifier not found

Adding #include <algorithm> to each of these files helped solve the errors, however there are some linker errors in relation to readPRT / writePRT methods afterwards:

ParticleIO.obj : error LNK2019: unresolved external symbol "class Partio::ParticlesDataMutable * __cdecl Partio::readPRT(char const *,bool,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?readPRT@Partio@@YAPEAVParticlesDataMutable@1@PEBD_NPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Partio::ParticlesDataMutable * (__cdecl*)(char const *,bool,class std::basic_ostream<char,struct std::char_traits<char> > *),struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class Partio::ParticlesDataMutable * (__cdecl*)(char const *,bool,class std::basic_ostream<char,struct std::char_traits<char> > *)> > > & __cdecl Partio::readers(void)" (?readers@Partio@@YAAEAV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@P6APEAVParticlesDataMutable@Partio@@PEBD_NPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@@ZU?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@P6APEAVParticlesDataMutable@Partio@@PEBD_NPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@@Z@std@@@2@@std@@XZ)

1>ParticleIO.obj : error LNK2019: unresolved external symbol "bool __cdecl Partio::writePRT(char const *,class Partio::ParticlesData const &,bool,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?writePRT@Partio@@YA_NPEBDAEBVParticlesData@1@_NPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool (__cdecl*)(char const *,class Partio::ParticlesData const &,bool,class std::basic_ostream<char,struct std::char_traits<char> > *),struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,bool (__cdecl*)(char const *,class Partio::ParticlesData const &,bool,class std::basic_ostream<char,struct std::char_traits<char> > *)> > > & __cdecl Partio::writers(void)" (?writers@Partio@@YAAEAV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@P6A_NPEBDAEBVParticlesData@Partio@@_NPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@@ZU?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@P6A_NPEBDAEBVParticlesData@Partio@@_NPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@@Z@std@@@2@@std@@XZ)

In PRT.cpp the definition for read/writePRT and since PARTIO_WIN32 preprocessor is used, there should not have been an issue as their implementation is there. What is strange however is that if you go to line 69 and 98 in ParticleIO.cpp, when you ask VS to go to definition of readPRT and writePRT it incorrectly points to lines 149 and 347 of PRT.cpp which reside in the wrong block of code. That is the block of code when the preprocessor PARTIO_WIN32 is not used. VS should have pointed to lines 440 and 447 right?



Anthony Kavassis

unread,
Jun 15, 2018, 4:38:54 AM6/15/18
to partio-discuss
Upon further inspection I think the following might be the culpit.

Definition of readPRT and writePRT in io/readers.h is:

48: ParticlesDataMutable* readPRT(const char* filename,const bool headersOnly,std::ostream* errorStream);

61: bool writePRT(const char* filename,const ParticlesData& p,const bool compressed,std::ostream* errorStream);

whereas in PRT.cpp they are specified as:

440: ParticlesDataMutable* readPRT(const char* filename,const bool headersOnly)

447: bool writePRT(const char* filename,const ParticlesData& p,const bool /*compressed*/)

thus implementations need to be adapted to match their definitions in readers.h and no more linker error.





David Aguilar

unread,
Jun 19, 2018, 6:39:01 PM6/19/18
to partio-...@googlegroups.com
I committed a fix. This was in a WIN32-only #define which is why we
never saw it.

Thanks for the heads-up.
> --
> You received this message because you are subscribed to the Google Groups
> "partio-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to partio-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
David

Anthony Kavassis

unread,
Jun 20, 2018, 3:14:34 AM6/20/18
to partio-discuss
Glad I could help David.

In relation to mix/max not found compilation error in VS2015, would adding #include <algorithm> be the right approach?

David Aguilar

unread,
Jun 21, 2018, 6:19:50 PM6/21/18
to partio-...@googlegroups.com
Yup, that fixed it -- I just pushed those changes up. It's kinda
curious that we don't get those errors when compiling on linux, but
perhaps there's a subtle difference in the stdlib that makes std::min
and std::max available. It should be happy now, though.

Thanks again!

Anthony Kavassis

unread,
Jun 22, 2018, 6:51:15 AM6/22/18
to partio-discuss
That is really great David, am very happy to hear it. 
Reply all
Reply to author
Forward
0 new messages