Sign in to follow this  
popcorn

Help with guichan and SDL

Recommended Posts

I downloaded the newest version of guichan and then tried to follow the instructions on the guichan wiki on how to use it, but I've found it quite difficult. I think I've got it working but it's not clear to me if I've done the right thing. I'm using vc++ express 2008 and managed to set up the include files by going to tools->options->projects etc and to get it working I just included all the source files for each header in my actual project as shown in the pic below: Is this the right thing to do? Everything compiles fine and the program runs but I don't imagine that its a good idea to do this for every project right?

Share this post


Link to post
Share on other sites
Hi popcorn:

I have reading guichan userguide, and there isn't an easy way to compile guichan.
You could try to compile it as a static library, but i don't know if it is possible.

It seems the single way to go.

Share this post


Link to post
Share on other sites
Quote:
Original post by aaron_ds
It's fine. hpp headers are meant to be used this way. Pretty much all of Boost is hpp's that are used exactly like this.


I think what he's worried about is that all the guichan source files are in his "source files" directory (see left column of the screenshot) instead of being off in a separate library.

OP, does this help?

Share this post


Link to post
Share on other sites
That's exactly what I'm worried about Zahlman, I don't won't all the guichan files along with my own files in every project I create, plus it does increase compilation times with so many files. It does look like creating a static library is the way to go, I've just tried the msdn example called creating and using a static library and it works fine so it's looking good at the moment.

Can anyone explain more about this which is taken from the guichan wiki:
Quote:

As there are numerous problems with providing pre built binaries for a C++ library, such as binary incompatibility between compilers and different versions of the same compiler, only the source of Guichan is provided since Guichan 0.7.0.


Does this gamedev article provide an explanation for the guichan quote, particularly the part in the article about calling conventions?

Also what about the part about exception handling/RTTI as well as debugging in the gamedev article, the MSDN article doesn't mention anything about these, since the gamedev article is about 9 years old are these issues that you still need to worry about with more modern IDE's?

Share this post


Link to post
Share on other sites
Ok I think I've managed to create a static library for the guichan files but it doesn't work the way I imagined it to.

I thought I could do this:
1. build the guichanlib project
2. get the static libray from the release folder
3. create a new directory called lib in my c drive
4. copy the static libary to the lib folder in my c drive
5. create a new test project
6. to to tools -> options -> projects and solutions -> VC++ directories and then include the location for my newly created static library.
7. put in some test code

I get a lot of link errors:


1>Linking...
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Label::Label(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Label@gcn@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual struct SDL_Surface * __thiscall gcn::SDLImageLoader::convertToStandardFormat(struct SDL_Surface *)" (?convertToStandardFormat@SDLImageLoader@gcn@@MAEPAUSDL_Surface@@PAU3@@Z)
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual struct SDL_Surface * __thiscall gcn::SDLImageLoader::loadSDLSurface(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?loadSDLSurface@SDLImageLoader@gcn@@MAEPAUSDL_Surface@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual class gcn::Image * __thiscall gcn::SDLImageLoader::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (?load@SDLImageLoader@gcn@@UAEPAVImage@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl gcn::Image::setImageLoader(class gcn::ImageLoader *)" (?setImageLoader@Image@gcn@@SAXPAVImageLoader@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Gui::Gui(void)" (??0Gui@gcn@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::ImageFont::ImageFont(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0ImageFont@gcn@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::SDLInput::SDLInput(void)" (??0SDLInput@gcn@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl gcn::Widget::setGlobalFont(class gcn::Font *)" (?setGlobalFont@Widget@gcn@@SAXPAVFont@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall gcn::Widget::setBackgroundColor(class gcn::Color const &)" (?setBackgroundColor@Widget@gcn@@QAEXABVColor@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall gcn::Widget::setBaseColor(class gcn::Color const &)" (?setBaseColor@Widget@gcn@@QAEXABVColor@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: class gcn::Rectangle const & __thiscall gcn::Widget::getDimension(void)const " (?getDimension@Widget@gcn@@QBEABVRectangle@2@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall gcn::Widget::setDimension(class gcn::Rectangle const &)" (?setDimension@Widget@gcn@@QAEXABVRectangle@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall gcn::Widget::setPosition(int,int)" (?setPosition@Widget@gcn@@QAEXHH@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::TextBox::TextBox(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0TextBox@gcn@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Container::Container(void)" (??0Container@gcn@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Rectangle::Rectangle(int,int,int,int)" (??0Rectangle@gcn@@QAE@HHHH@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Color::Color(int)" (??0Color@gcn@@QAE@H@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Color::Color(int,int,int,int)" (??0Color@gcn@@QAE@HHHH@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::Button::Button(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Button@gcn@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall gcn::SDLGraphics::SDLGraphics(void)" (??0SDLGraphics@gcn@@QAE@XZ)



So it seems the ide cannot find all the functions but I'm pretty sure I've included the location of the static library.

Anyone know what is going on?

Share this post


Link to post
Share on other sites
Quote:
Original post by popcorn
Also what about the part about exception handling/RTTI as well as debugging in the gamedev article, the MSDN article doesn't mention anything about these, since the gamedev article is about 9 years old are these issues that you still need to worry about with more modern IDE's?


The problem which will always exist is the fact that the C++ standard specifies behavior not implementation. The standard says references will behave a certain way the compiler writer can implement references anyway they want as long as they behave properly. So now compiler A implements references with pointers behind the scenes and compiler B uses some other odd scheme. Now you have a library compiled by A in that library it uses a reference in its public interface. How exactly is compiler B supposed to deduce what the heck compiler A did? Answer: It can't so you can't use the library. Suppose A is version 6 and B is version 7 of the same compiler from the same vendor. It just doesn't work.

Share this post


Link to post
Share on other sites
Thanks for explaining stonemetal, does anyone know how to resolve my other problem though, I can only get this working if I follow the example on microsofts website, this means that I have 2 projects in my solution, one for the static library and then one for the actual project.

I expected that once you created the static library and then put it in to a directory and set the ide to look in that directory then you would be able to use the code from the static library but it doesn't appear to be the case.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this