Bug Fix apiGen.cpp

MatrixNAN
Posts: 2
Joined: Mon Feb 15, 2010 12:58 am

Bug Fix apiGen.cpp

Post by MatrixNAN »

At Line 26 Add the code #include <string.h> to fix the following errors.

/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp: In function ‘int main(int, char**)’:
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:223: warning: deprecated conversion from string constant to ‘char*’
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:287: error: ‘strncmp’ is not a member of ‘std::string’
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:289: error: ‘strncmp’ was not declared in this scope
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:315: error: ‘strlen’ was not declared in this scope
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp: In function ‘int _getArraySize(char*)’:
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:356: error: ‘strlen’ was not declared in this scope
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:358: error: ‘memcpy’ was not declared in this scope
make[2]: *** [Extras/Serialize/HeaderGenerator/CMakeFiles/HeaderGenerator.dir/apiGen.o] Error 1
make[1]: *** [Extras/Serialize/HeaderGenerator/CMakeFiles/HeaderGenerator.dir/all] Error 2
make: *** [all] Error 2

After this code is added the error messages will become like this:
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp: In function ‘int main(int, char**)’:
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:223: warning: deprecated conversion from string constant to ‘char*’

This is compiled on Ubuntu 9.04 64bit. With examples turned on and demos turned off. Shared Libs are turned on. I hope this helps.
If this is not the correct way to submit bugs and fixes please inform me of the proper method.

Cheers,
Nate Nesler
Grimreaper85
Posts: 4
Joined: Mon Feb 15, 2010 1:29 am

Re: Bug Fix apiGen.cpp

Post by Grimreaper85 »

I've compiled the latest bullet-2.76-r2001 on ubuntu 9.10 32bit. and received no errors. I have had errors with previous beta releases though, so if you were compiling an older beta its may have been fixed ?
memoni
Posts: 2
Joined: Sun Jan 31, 2010 12:39 pm

Re: Bug Fix apiGen.cpp

Post by memoni »

That error can be fixed by using 'const'... that is:

const char* filename = "../../../Demos/SerializeDemo/testFile.bullet";

The fix can be applied to function arguments too if you encounter one. You can pass static strings only as const char*, not char* since their contents cannot be changed.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bug Fix apiGen.cpp

Post by Erwin Coumans »

MatrixNAN wrote:At Line 26 Add the code #include <string.h> to fix the following errors.
Thanks for the report, it has been fixed in latest trunk. Note that the default cmake options don't compile this HeaderGenerator directory.
After this code is added the error messages will become like this:
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp: In function ‘int main(int, char**)’:
/home/nate/Programming/bullet-read-only/Extras/Serialize/HeaderGenerator/apiGen.cpp:223: warning: deprecated conversion from string constant to ‘char*’
This is not an error, but some obnoxious warning.

Thanks,
Erwin
MatrixNAN
Posts: 2
Joined: Mon Feb 15, 2010 12:58 am

Re: Bug Fix apiGen.cpp

Post by MatrixNAN »

Hey Erwin,


I am sorry I was trying say that the errors were all gone aside from the warnings which I am not worried about. I find it extremely difficult to get rid of warnings when doing cross platform compatible programming. I will be more accurate in the future with what I write to not mistake my meaning. Thanks for the Update :) :D

memoni:
Thanks for the heads up for getting rid of the warning I will have to remember that one. Its so obvious I don't know why I didn't even think of it at the time of posting. I am going to keep it in mind in the future. I don't know all of the ins and outs of Bullet. I am getting more comfortable as I program with the Library in Open Scene Graph.

Grimreaper85:
I downloaded from the svn and did a compile and that was my fix at the time of writing. So I was not using the zipped beta or what not. I am trying to be a bit helpful. Often times I download code make fixes but don't know where to tell people about the bugs and fixes. So this is great because if this is acceptable place to talk about bugs and fixes then I will continue to post fixes to bugs I find in the source code when I compile. Just trying to help out a bit. :) ;)

Cheers,
Nate Nesler