On 9 May 2012 13:22, David Lonie <david.lo...@kitware.com> wrote:

> On Wed, May 9, 2012 at 7:42 AM, David Lonie <david.lo...@kitware.com>wrote:
>
>> On Wed, May 9, 2012 at 4:42 AM, Noel O'Boyle <baoille...@gmail.com>wrote:
>>
>>> In the OB docs, there's an example C++ program. Can you edit this so
>>> that it reproduces the problem?
>>>
>>
>> I'll give this a try.
>>
>
>  Surprisingly, I was able to reproduce this on the first try :-)
>
> Steps to reproduce with MSVC C++ 2010 Express:
>
> 1) File > New > Project
> 2) Win32 Console Application, name openbabel-test
> 3) Ok
> 4) Next
> 5) Check "Empty Project"
> 6) Right click on Source Files in solution explorer, Add > New Item > C++
> file, name main.cpp > Add
> 7) Write source file:
>
> #include <iostream>
> #include <openbabel/mol.h>
>
> int main(int argc, char **argv)
> {
> int atomicNum = 4;
>  std::cout << OpenBabel::etab.GetSymbol(atomicNum)
> << " has an atomic number of " << atomicNum << std::endl;
>  return 0;
> }
>
> 8) Right click on openbabel-test in solution explorer > Properties
> 9) Select C/C++ in tree, add "C:\Program Files
> (x86)\openbabel\include\openbabel-2" to Additional Include Directories
> 10) Select "Linker" in tree, add "C:\Program Files (x86)\openbabel\bin" to
> Additional Library Directories
> 11) Select "Linker" > "Input" in tree, add openbabel-2.lib to Additional
> Dependencies
> 12) Build and fail:
>
> 1>------ Build started: Project: openbabel-test, Configuration: Debug
> Win32 ------
> 1>main.obj : error LNK2001: unresolved external symbol "class
> OpenBabel::OBElementTable OpenBabel::etab" (?etab@OpenBabel
> @@3VOBElementTable@1@A)
> 1>c:\users\dl\documents\visual studio
> 2010\Projects\openbabel-test\Debug\openbabel-test.exe : fatal error
> LNK1120: 1 unresolved externals
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>
> Can anyone reproduce?
>
>
Confirmed. It works fine if you create your own OBElementTable, but the
linker cannot find the global etab. I'm going to have to bounce this on to
Chris, whether he understands what's going on... That's strange though,
because it's possible to access all of these from the Python interface, so
they must be exposed (although I haven't checked this with MSVC 2010).

- Noel
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to