473,662 Members | 2,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linker error - VS2005 thinks it's a function declaration?

Base base;
BaseWrap& baseWrap(reinte rpret_cast<Base Wrap&>(base));
boost::python:: object obj(boost::shar ed_ptr<BaseWrap >(&baseWrap)) ; //
Compile error

Results in this error:

1>PythonPassRef erence.obj : error LNK2019: unresolved external symbol
"class boost::python:: api::object __cdecl obj(class
boost::shared_p tr<struct BaseWrap&)" (?obj@@YA?
AVobject@api@py thon@boost@@AAV ?$shared_ptr@UB aseWrap@@@4@@Z)
referenced in function _main

My first thought is somehow that looks like a function declaration
instead of creating an object on the stack and instantiating it. If I
remove the shared_ptr, the error goes away.

In case it helps, here's a few more details.

boost::python:: object has the following constructor:

// explicit conversion from any C++ object to Python
template <class T>
explicit object(
T const& x
# if BOOST_WORKAROUN D(BOOST_MSVC, < 1300)
// use some SFINAE to un-confuse MSVC about its
// copy-initialization ambiguity claim.
, typename mpl::if_<is_pro xy<T>,int&,int> ::type* = 0
# endif
)
: object_base(obj ect_base_initia lizer(x))
{
}

boost::shared_p tr<Thas the following constructor:

template<class Y>
explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be
complete
{
boost::detail:: sp_enable_share d_from_this( pn, p, p );
}

Any tips on how to solve this would be greatly appreciated. I'm
probably overlooking something obvious.

Thanks in advance,

Lawrence

Jul 17 '07 #1
1 2034
Lawrence Spector wrote:
Base base;
BaseWrap& baseWrap(reinte rpret_cast<Base Wrap&>(base));
boost::python:: object obj(boost::shar ed_ptr<BaseWrap >(&baseWrap)) ; //
Compile error

Results in this error:

1>PythonPassRef erence.obj : error LNK2019: unresolved external symbol
"class boost::python:: api::object __cdecl obj(class
boost::shared_p tr<struct BaseWrap&)" (?obj@@YA?
AVobject@api@py thon@boost@@AAV ?$shared_ptr@UB aseWrap@@@4@@Z)
referenced in function _main

My first thought is somehow that looks like a function declaration
instead of creating an object on the stack and instantiating it. If I
remove the shared_ptr, the error goes away.
Any tips on how to solve this would be greatly appreciated. I'm
probably overlooking something obvious.
You are overlooking something, but it's not that obvious. Your 'obj'
declaration is similar to

double obj(int(&blah)) ;

Care to parse it? A hint: the parentheses around &blah don't matter.

....

Give up? It's the same as

double obj(int &blah);

Look familiar? It's a function declaration!

How do you prevent this from being treated as a function declaration?
Put extra parentheses around the "argument":

double obj((int(&blah) ));

In your case:

boost::python:: object obj( (boost::shared_ ptr<BaseWrap>(& baseWrap)) );

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2199
by: william xuuu | last post by:
Actually, I also got linker errors with template functions and template classes. And I avoided both of them successfully, by pouring foo.cpp into foo.h, according to the C++ FAQ. (http://www.parashift.com/c++-faq-lite/containers-and-templates.html) And then, I pre-declared each template friend function above the definition of template class. But I still get template friends linker error. My compiler is gcc 3.3.3. Any hints? Thanks,
12
801
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions Guide" Using Dev-C++ 4.9.9.2, The error is: undefined reference to ‘f(int)’ all the following files are in the same dir. thanks
2
11187
by: AMT2K5 | last post by:
Hello. When I compile my program I recieve lots and lots of the following message which I am trying to decipher. "xxx was declared deprecated". What exactly does that mean?
3
1773
by: Steve Baer | last post by:
I recently read your whitepaper under the "extremely long link times" post and have a question that I was hoping you could answer. My question is based on the following paragraph: Directives The linker's handling of directives left something to be desired in VC2003, and for this reason code with lots of directives can suffer. In particular __declspec(export), as it's likely the most common linker directive. Besides that, don't export...
3
8062
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error LNK2028: unresolved token (0A000007) "extern "C" void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)" (?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public: virtual __thiscall...
6
2472
by: Sampei120 | last post by:
When I go to compile a project I see this error undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverEPKw' someone knows how can I do for delete this error??? Thanks
4
1844
by: PyongHopscotch | last post by:
Hi All, So I'm getting the generic linker error (unresolved external error) in VC 7.0 when I define a templatized function. Here's some code examples: template <class T> class Diploid2DArrayAlleleGenome : public GA2DArrayAlleleGenome<T> { public: Diploid2DArrayAlleleGenome(unsigned int x, unsigned int y,
1
1951
by: ImamicPH | last post by:
Hi, My first post. How do you resolve linker errors? I have a simple header file that contains one function declaration. This function is used in another file (.cpp) in the definition of a macro. There is another separate .cpp file that actually defines the function. I assumed that if I had these three separate source files saved in the same directory (C:\) that my compilier would find the header file along with the other .cpp file and...
3
11595
by: prakash.mirji | last post by:
Hello, I am getting below mention linker error when I tried to link my class test.C I use below command to compile test.C /usr/bin/g++ -g -fpic -fvisibility=default -D_POSIX_SOURCE -DTRACING - D__EXTENSIONS__ -D__RWCOMPILER_H__ -D_REENTRANT -D_RWCONFIG=8s - D_RWCONFIG_12d -D_RWSTDDEBUG -DRWDEBUG -o test1 test1.o -L/lib -
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.