Jump to content
  • Advertisement
Sign in to follow this  
Sillencer

Noob question about headers

This topic is 2788 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 have this from an example program from ClanLib, program.h :

#pragma once

// This is the Program class that is called by CL_ClanApplication
class Program
{
public:
static int main(const std::vector<CL_String> &args);
};


But I don't get it, how can this work in their project ?
In my project I should include <vector> and <ClanLib/core.h> for these, or the project won't compile...

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure exactly where your confusion is coming in but it looks as though that static function "main" will be called by whatever the real entry point of the application is (whether that's main or winmain or whatever else).

Instead of having "int argc" and "char **argv", the entry point passes the arguments as a vector of strings.

All looks ok to me...

does this answer your question at all?

Share this post


Link to post
Share on other sites
The idea was that program.h without the #include <vector> will give an error like "'std' : is not a class or namespace name" in my project, the same for #include <ClanLib/core.h>...

How comes in their project it's ok without those includes?

Share this post


Link to post
Share on other sites
it could be that they include those files before including program.h any place they need it

that might sound like "a lot of work", but if they have precompiled headers it could be in there... or if they have an include file that contains several other include files, it could just be set up that way and they include the "main" include file, not the individual ones.



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!