[Scip] template<typename T> T* docast(T*, void *v) { return reinterpret_cast<T*>(v); } in SCIP 1.2

michael.winkler@zib.de michael.winkler at zib.de
Mon Aug 30 05:02:54 MEST 2010


Hi,

so now your linker states that he doesn't find the libraries that contain
these methods. Can you please make a clean build and check for correct
linkage.

> Should I add them again?

If you mean by that adding "extern C" again, then no. Probably we didn't
describe well enough what to do with the "extern C" after changing from
version 1.1 to 1.2:

All C header files inside SCIP define for there C code the "extern C",
that's correct and this should be valid for your own C header files too.
That's because no user has to know whether he/she includes code is C or
C++. That means if you are writing some C++ plugins/programms for/with
SCIP you still need to include the correct needed header files (e.g.
pub_message.h, pub_var.h, scip.h) but you doesn't need the "extern C"
around these includes anymore.

Best, Michael

>
>   Hey,
>
> I removed the extern C statements from my code and now I get the
> following errors (the SCIP source code still does have the extern C
> statements (for example memory.h):
> 4>AuxiliaryFunctions.obj : error LNK2019: unresolved external symbol
> SCIPmessagePrintError referenced in function "enum SCIP_Retcode __cdecl
> TrySolution(struct Scip *,class std::map<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >,class CAircraft *,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 CAircraft *> > > &)"
> (?TrySolution@@YA?AW4SCIP_Retcode@@PEAUScip@@AEAV?$map at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PEAVCAircraft@@U?$less at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@2 at V?$allocator at U?$pair@$$CBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PEAVCAircraft@@@std@@@2@@std@@@Z)
> 4>cppmain.obj : error LNK2001: unresolved external symbol
> SCIPmessagePrintError
> 4>CreateConstraints.obj : error LNK2001: unresolved external symbol
> SCIPmessagePrintError
> 4>CreateVar.obj : error LNK2001: unresolved external symbol
> SCIPmessagePrintError
> 4>AuxiliaryFunctions.obj : error LNK2019: unresolved external symbol
> SCIPmessagePrintErrorHeader referenced in function "enum SCIP_Retcode
> __cdecl TrySolution(struct Scip *,class std::map<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >,class CAircraft *,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 CAircraft *> > > &)"
> (?TrySolution@@YA?AW4SCIP_Retcode@@PEAUScip@@AEAV?$map at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PEAVCAircraft@@U?$less at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@2 at V?$allocator at U?$pair@$$CBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PEAVCAircraft@@@std@@@2@@std@@@Z)
> 4>cppmain.obj : error LNK2001: unresolved external symbol
> SCIPmessagePrintErrorHeader
> 4>CreateConstraints.obj : error LNK2001: unresolved external symbol
> SCIPmessagePrintErrorHeader
> 4>CreateVar.obj : error LNK2001: unresolved external symbol
> SCIPmessagePrintErrorHeader
> 4>AuxiliaryFunctions.obj : error LNK2019: unresolved external symbol
> SCIPfixVar referenced in function "enum SCIP_Retcode __cdecl
> TrySolution(struct Scip *,class std::map<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >,class CAircraft *,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 CAircraft *> > > &)"
> (?TrySolution@@YA?AW4SCIP_Retcode@@PEAUScip@@AEAV?$map at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PEAVCAircraft@@U?$less at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@2 at V?$allocator at U?$pair@$$CBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PEAVCAircraft@@@std@@@2@@std@@@Z)
> 4>cppmain.obj : error LNK2019: unresolved external symbol
> BMScheckEmptyMemory_call referenced in function main
> 4>cppmain.obj : error LNK2019: unresolved external symbol SCIPfree
> referenced in function main
> 4>cppmain.obj : error LNK2019: unresolved external symbol
> SCIPprintStatistics referenced in function main
> ...
> Should I add them again?
> Sebastian
>
>
> On 28/08/2010 5:54 AM, Stefan Heinz wrote:
>> Hi Sebastian,
>>
>> I'm not 100% sure but if you check the web page "Interface changes
>> between
>> SCIP 1.1 and SCIP 1.2" http://scip.zib.de/doc/html/CHG3.html you might
>> have to do the last point:
>> - A significant change for C++ users is that all include files of SCIP
>> automatically detect C++ mode, i.e., no extern "C" is needed anymore.
>>
>> Best Stefan
>>
>>> Hi,
>>>
>>> what compiler and what compiler-version du you use.
>>>
>>> Best, Michael
>>>
>>>>    Hey,
>>>>
>>>> I recently upgraded from SCIP 1.1 to 1.2 and now I get the following
>>>> error:
>>>> 4>Z:\sr721\scip-1.2.0\src\blockmemshell/memory.h(33): error C2894:
>>>> templates cannot be declared to have 'C' linkage
>>>> it's caused by statement template<typename T>  T* docast(T*, void *v)
>>>> {
>>>> return reinterpret_cast<T*>(v); } of file memory.h
>>>> I checked and the line doesn't exist in my 1.1 version of memory.h.
>>>>
>>>> What do I need to do?
>>>> Thank you
>>>> Sebastian
>>>> _______________________________________________
>>>> Scip mailing list
>>>> Scip at zib.de
>>>> http://listserv.zib.de/mailman/listinfo/scip
>>>>
>>> _______________________________________________
>>> Scip mailing list
>>> Scip at zib.de
>>> http://listserv.zib.de/mailman/listinfo/scip
>>>
>>
>



More information about the Scip mailing list