Jump to content
  • Advertisement
Sign in to follow this  
Rain Dog

Compiler error registering std::string operator==

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I discovered today that this is due to using precompiled headers. Prior to using precompiled headers I had no problem registering operator== for std::string in AS. After configuring my project to use precompiled headers, no longer am I able to do so without the fatal error. Also, Deyja's preprocessor appears to suffer some incompatabilities with precompiled headers too.

Share this post


Link to post
Share on other sites
Advertisement
Precompiled headers really only work if the project is written with them from the begining. I've never used them, because they are a terrible solution to the problem they are supposed to solve. So naturally my advice is: Turn off precompiled headers, and do it without the monolithic header.

Share this post


Link to post
Share on other sites
I'm just trying to improve my build times. My project is rather large now and if I have to do a rebuild it takes quite some time.

Precompiled headers really are not that difficult to use. All that is required is that it is included at the beginning of each source file.

The only problems i had are those that I described, 2 small errors for a large project is not too bad. I resolved the issue just by turning precompiled headers for those 2 files off and everything works.

I just wanted to give everyone a heads up as to why msvc was giving an error message on seemingly random method pointers.

Share this post


Link to post
Share on other sites
On a related note, one approach to improve build times is to have #include's defined only in your C/CPP files and not in the header files themselves. The downside of this is that you'll need to add a lot more includes in your source files, but the upside is that header dependencies are minimised, leading to shorter (incremental) build times. It should also simplify cross-dependency issues between structs/classes.

Share this post


Link to post
Share on other sites
Or you could do it right and only include exactly what you need, ever. Headers can include headers if the header requires that header. Including more than neccessary is better than headers that only work if included in exactly the right order.

Share this post


Link to post
Share on other sites
Thanks for letting us know, Rain Dog.

I'm putting together a FAQ, and have already included your solution in that one. I'm crediting you for the solution, of course. [smile]

The FAQ is still quite small, so there's not much use showing it yet, but it grows steadily. Hopefully it will be a good addition to the library manual.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!