Page 1 of 1

C++ boost alternitive.

Posted: Thu Jul 07, 2011 9:55 pm
by THe Floating Brain
I would like to use the C++ boost library's "any" class. However when I downloaded the boost library's I immediately got run-time errors (on a program that ran fine before I downloaded the boost library's). I was wondering if there was something similar or alternative to using the "any" class.

Re: C++ boost alternitive.

Posted: Thu Jul 07, 2011 11:28 pm
by bnpph
Why do you need to use boost::any? You can probably achieve the same result using a different way.

Re: C++ boost alternitive.

Posted: Fri Jul 08, 2011 12:11 am
by XianForce
bnpph wrote:Why do you need to use boost::any? You can probably achieve the same result using a different way.
It sounds to me like he's asking what that "different way" is.

And if you got runtime errors, then you probably didn't install boost correctly. I say reinstall it, so you learn how to correctly install libraries... It's a necessary skill, I'd say :o

Re: C++ boost alternitive.

Posted: Fri Jul 08, 2011 12:26 am
by THe Floating Brain
XianForce wrote:
bnpph wrote:Why do you need to use boost::any? You can probably achieve the same result using a different way.
It sounds to me like he's asking what that "different way" is.

And if you got runtime errors, then you probably didn't install boost correctly. I say reinstall it, so you learn how to correctly install libraries... It's a necessary skill, I'd say :o
(Please correct me if I did this incorrectly)
1: Extracted files to my desktop.
2: Put the "boost" folder inside of C:\Program Files\Microsoft Visual Studio 9.0\VC\include .
3: Went into my project Options > *Project Name* Properties > Configurations and Settings (I think) > C\C++ > general > Add Include Directory ( C:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost).
???

Re: C++ boost alternitive.

Posted: Fri Jul 08, 2011 5:02 am
by MrDeathNote
THe Floating Brain wrote:
XianForce wrote:
bnpph wrote:Why do you need to use boost::any? You can probably achieve the same result using a different way.
It sounds to me like he's asking what that "different way" is.

And if you got runtime errors, then you probably didn't install boost correctly. I say reinstall it, so you learn how to correctly install libraries... It's a necessary skill, I'd say :o
(Please correct me if I did this incorrectly)
1: Extracted files to my desktop.
2: Put the "boost" folder inside of C:\Program Files\Microsoft Visual Studio 9.0\VC\include .
3: Went into my project Options > *Project Name* Properties > Configurations and Settings (I think) > C\C++ > general > Add Include Directory ( C:\Program Files\Microsoft Visual Studio 9.0\VC\include\boost).
???
You need to add the lib folder to your library files (similar to Include Directories). Then you need to go into your linker options for the project and add the actual lib files to your additional dependencies.

Re: C++ boost alternitive.

Posted: Fri Jul 08, 2011 2:40 pm
by THe Floating Brain
MrDeathNote wrote: You need to add the lib folder to your library files (similar to Include Directories). Then you need to go into your linker options for the project and add the actual lib files to your additional dependencies.
I went to the file but I did not see a single .lib or .dll in there 0.0

Re: C++ boost alternitive.

Posted: Fri Jul 08, 2011 4:05 pm
by MrDeathNote
THe Floating Brain wrote:
MrDeathNote wrote: You need to add the lib folder to your library files (similar to Include Directories). Then you need to go into your linker options for the project and add the actual lib files to your additional dependencies.
I went to the file but I did not see a single .lib or .dll in there 0.0
Which boost libs are you using? A lot of them are header only, so you may not need a .lib or .dll. Also, what runtime errors are you getting? Out of curiosity, have you checked out this page?

http://www.boost.org/doc/libs/1_46_1/mo ... ndows.html

Re: C++ boost alternitive.

Posted: Sun Jul 10, 2011 8:56 pm
by THe Floating Brain
MrDeathNote wrote:
THe Floating Brain wrote:
MrDeathNote wrote: You need to add the lib folder to your library files (similar to Include Directories). Then you need to go into your linker options for the project and add the actual lib files to your additional dependencies.
I went to the file but I did not see a single .lib or .dll in there 0.0
Which boost libs are you using? A lot of them are header only, so you may not need a .lib or .dll. Also, what runtime errors are you getting? Out of curiosity, have you checked out this page?

http://www.boost.org/doc/libs/1_46_1/mo ... ndows.html
-----------------------------------------------------------------EDIT-----------------------------------------------------------------
Thank you for the link. I was able to compile the lib's. But I still get the error. The error I get is when I try to use luabind.

I have a class (this happens even if the class does not have a template argument):

Code: Select all

template<class T>
class Printer
{
	T t;
public:
	Printer(){}
	void Print( T value )
	{
		t = value;
		std::cout<<t<<std::endl;
	}
};

Then this is my wrapper (which I have determined the is the source of the problem even when NOT using a template argument on my class):

Code: Select all

	luabind::module( Lua )
	[
		luabind::class_<Printer<std::string>>( "Printer" )
		.def( luabind::constructor<>() )
		.def( "Print", &Printer<std::string>::Print)
	];
The error I get is

Code: Select all

Unhandled exception at 0xbd0015ff in Test Boost.exe: 0xC0000005: Access violation.
Then it brings me to line 880 of function_template.hpp .
If I take out the boost library's the program runs perfectly.