Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C2143

C2143

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++
19 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T toxcct

    so you didn't read my post !!! i said the error is NOT in the globals.h file itself but around it. when you #include a header, it's as if its content was copied/pasted at the location of the #include directive. so if you have an arror in a file #included before that one, on in the including file itself, you might see such errors in files you actually didn't modified. also, if it's a system file, be sure to #include **<>** rather than #include **""**

    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

    T Offline
    T Offline
    T RATHA KRISHNAN
    wrote on last edited by
    #5

    Here is my complete listings where the 'globals.h' is included.

    #include "HelloWorld.h"
    #include <dtCore/globals.h>
    #include <dtCore/object.h>
    #include <dtCore/orbitmotionmodel.h>
    #include <dtCore/scene.h>
    #include <osgDB/FileUtils>
    #include <dtCore/dt.h>
    #include <dtABC/application.h>

    If include HelloWorld.h like u said () it shows me error which says Cannot open include file. No such file or Directory. What to do?

    C T 2 Replies Last reply
    0
    • T T RATHA KRISHNAN

      Here is my complete listings where the 'globals.h' is included.

      #include "HelloWorld.h"
      #include <dtCore/globals.h>
      #include <dtCore/object.h>
      #include <dtCore/orbitmotionmodel.h>
      #include <dtCore/scene.h>
      #include <osgDB/FileUtils>
      #include <dtCore/dt.h>
      #include <dtABC/application.h>

      If include HelloWorld.h like u said () it shows me error which says Cannot open include file. No such file or Directory. What to do?

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #6

      I can't believe HelloWorld.h being a system header. BTW usually non-system headers includes (like #include "HelloWorld.h") follows the system ones. Your snippet shows the opposite. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      T 1 Reply Last reply
      0
      • T T RATHA KRISHNAN

        Here is my complete listings where the 'globals.h' is included.

        #include "HelloWorld.h"
        #include <dtCore/globals.h>
        #include <dtCore/object.h>
        #include <dtCore/orbitmotionmodel.h>
        #include <dtCore/scene.h>
        #include <osgDB/FileUtils>
        #include <dtCore/dt.h>
        #include <dtABC/application.h>

        If include HelloWorld.h like u said () it shows me error which says Cannot open include file. No such file or Directory. What to do?

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #7

        what happens if you #include "HelloWorld.h" after every other system includes ?

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        T 1 Reply Last reply
        0
        • C CPallini

          I can't believe HelloWorld.h being a system header. BTW usually non-system headers includes (like #include "HelloWorld.h") follows the system ones. Your snippet shows the opposite. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

          T Offline
          T Offline
          T RATHA KRISHNAN
          wrote on last edited by
          #8

          Not HelloWorld.h. It's globals.h.

          C 1 Reply Last reply
          0
          • T T RATHA KRISHNAN

            Not HelloWorld.h. It's globals.h.

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #9

            I was suggesting (the same toxcct did) to put #include "HelloWorld.h" at the end of your include list. Often problems originate in slightly different places with respect the one the misbehaviour shows up. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

            1 Reply Last reply
            0
            • T toxcct

              what happens if you #include "HelloWorld.h" after every other system includes ?

              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              T Offline
              T Offline
              T RATHA KRISHNAN
              wrote on last edited by
              #10

              It gives me errors if I include after all the system files. d:\myprojects\myprojects\myprojects\helloworld.cpp(13) : error C2533: 'HelloWorld::{ctor}' : constructors not allowed a return type d:\myprojects\myprojects\myprojects\helloworld.cpp(65) : error C2264: 'HelloWorld::HelloWorld' : error in function definition or declaration; function not called

              C C 2 Replies Last reply
              0
              • T T RATHA KRISHNAN

                It gives me errors if I include after all the system files. d:\myprojects\myprojects\myprojects\helloworld.cpp(13) : error C2533: 'HelloWorld::{ctor}' : constructors not allowed a return type d:\myprojects\myprojects\myprojects\helloworld.cpp(65) : error C2264: 'HelloWorld::HelloWorld' : error in function definition or declaration; function not called

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #11

                Please post the code. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                T 1 Reply Last reply
                0
                • T T RATHA KRISHNAN

                  It gives me errors if I include after all the system files. d:\myprojects\myprojects\myprojects\helloworld.cpp(13) : error C2533: 'HelloWorld::{ctor}' : constructors not allowed a return type d:\myprojects\myprojects\myprojects\helloworld.cpp(65) : error C2264: 'HelloWorld::HelloWorld' : error in function definition or declaration; function not called

                  C Offline
                  C Offline
                  Cedric Moonen
                  wrote on last edited by
                  #12

                  Then it probably means you have errors in that file. Post some code (and please, use the code block tags).

                  Cédric Moonen Software developer
                  Charting control [v1.4]

                  T 1 Reply Last reply
                  0
                  • C Cedric Moonen

                    Then it probably means you have errors in that file. Post some code (and please, use the code block tags).

                    Cédric Moonen Software developer
                    Charting control [v1.4]

                    T Offline
                    T Offline
                    T RATHA KRISHNAN
                    wrote on last edited by
                    #13

                    Here is the complete listing.

                    #include "HelloWorld.h"
                    #include <dtCore/globals.h>
                    #include <dtCore/object.h>
                    #include <dtCore/orbitmotionmodel.h>
                    #include <dtCore/scene.h>
                    #include <osgDB/FileUtils>
                    #include <dtCore/dt.h>
                    #include <dtABC/application.h>
                    #include <dtCore/deltawin.h>

                    HelloWorld::HelloWorld(const std::string& configFilename):dtABC::Application(configFilename),mText(0),mOrbitMotionModel(0)
                    {
                    // Generating a default config file if the one passed in is not there.

                    if(osgDB::findDataFile(configFilename).empty())
                    

                    {
                    GenerateDefaultConfigFile();
                    }
                    }
                    HelloWorld::~HelloWorld()
                    {
                    }

                    void HelloWorld::Config()
                    {
                    // Allocate a dtCore::Object. This class will be your basic container
                    // for 3D meshes.
                    mText = new dtCore::Object("Text");
                    // Load the model file, in this case a OpenFligth model (.flt)
                    mText->LoadFile("HelloWorld.flt");
                    // Add the Object to the scene. Since mText is a RefPtr, we must
                    // pull the internal point out to pass it to the Scene.
                    GetScene()->AddDrawable( mText.get() );
                    // Adjust the Camera position by instantiating a transform object to
                    // store the camera position and attitude.
                    dtCore:: Transform camPos;
                    camPos.SetLookAt( 0.0f, -100.0f, 20.0f, // Position
                    0.0f, 0.0f, 0.0f, // Look At
                    0.0f, 0.0f, 1.0f); // Up Vector
                    GetCamera()->SetTransform(camPos);
                    // Setting a motion model for the camera

                    mOrbitMotionModel = new dtCore::OrbitMotionModel(GetKeyboard(),GetMouse());

                    // Setting the camera as a target for the motion model. The object (the hello
                    // world 3D text) will be static at 0,0,0 and the camera will move using
                    // the right clicked mouse.
                    mOrbitMotionModel->SetTarget(GetCamera());
                    }

                    int main()
                    {
                    // Setup the data file search paths for the config file and the models files.
                    // This is best done in main prior to configuring app. That way the paths
                    // are ensured to be correct when loading data.
                    dtCore::SetDataFilePathList( ".;" + dtCore::GetDeltaDataPathList());

                    // Instantiate the application and look for the config file
                    // You do not have to call delete on this.
                    dtCore::RefPtr<HelloWorld> app = new HelloWorld( "config.xml" );
                    // Configure the application
                    app->Config();
                    // Run the simulation loop
                    app->Run();

                    return 0;
                    

                    }

                    1 Reply Last reply
                    0
                    • C CPallini

                      Please post the code. :)

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                      T Offline
                      T Offline
                      T RATHA KRISHNAN
                      wrote on last edited by
                      #14

                      Here is the code.

                      #include "HelloWorld.h"
                      #include <dtCore/globals.h>
                      #include <dtCore/object.h>
                      #include <dtCore/orbitmotionmodel.h>
                      #include <dtCore/scene.h>
                      #include <osgDB/FileUtils>
                      #include <dtCore/dt.h>
                      #include <dtABC/application.h>
                      #include <dtCore/deltawin.h>

                      HelloWorld::HelloWorld(const std::string& configFilename):dtABC::Application(configFilename),mText(0),mOrbitMotionModel(0)
                      {
                      // Generating a default config file if the one passed in is not there.

                      if(osgDB::findDataFile(configFilename).empty())
                      

                      {
                      GenerateDefaultConfigFile();
                      }
                      }
                      HelloWorld::~HelloWorld()
                      {
                      }

                      void HelloWorld::Config()
                      {
                      // Allocate a dtCore::Object. This class will be your basic container
                      // for 3D meshes.
                      mText = new dtCore::Object("Text");
                      // Load the model file, in this case a OpenFligth model (.flt)
                      mText->LoadFile("HelloWorld.flt");
                      // Add the Object to the scene. Since mText is a RefPtr, we must
                      // pull the internal point out to pass it to the Scene.
                      GetScene()->AddDrawable( mText.get() );
                      // Adjust the Camera position by instantiating a transform object to
                      // store the camera position and attitude.
                      dtCore:: Transform camPos;
                      camPos.SetLookAt( 0.0f, -100.0f, 20.0f, // Position
                      0.0f, 0.0f, 0.0f, // Look At
                      0.0f, 0.0f, 1.0f); // Up Vector
                      GetCamera()->SetTransform(camPos);
                      // Setting a motion model for the camera

                      mOrbitMotionModel = new dtCore::OrbitMotionModel(GetKeyboard(),GetMouse());

                      // Setting the camera as a target for the motion model. The object (the hello
                      // world 3D text) will be static at 0,0,0 and the camera will move using
                      // the right clicked mouse.
                      mOrbitMotionModel->SetTarget(GetCamera());
                      }

                      int main()
                      {
                      // Setup the data file search paths for the config file and the models files.
                      // This is best done in main prior to configuring app. That way the paths
                      // are ensured to be correct when loading data.
                      dtCore::SetDataFilePathList( ".;" + dtCore::GetDeltaDataPathList());

                      // Instantiate the application and look for the config file
                      // You do not have to call delete on this.
                      dtCore::RefPtr<HelloWorld> app = new HelloWorld( "config.xml" );
                      // Configure the application
                      app->Config();
                      // Run the simulation loop
                      app->Run();

                      return 0;
                      

                      }

                      C 1 Reply Last reply
                      0
                      • T T RATHA KRISHNAN

                        Here is the code.

                        #include "HelloWorld.h"
                        #include <dtCore/globals.h>
                        #include <dtCore/object.h>
                        #include <dtCore/orbitmotionmodel.h>
                        #include <dtCore/scene.h>
                        #include <osgDB/FileUtils>
                        #include <dtCore/dt.h>
                        #include <dtABC/application.h>
                        #include <dtCore/deltawin.h>

                        HelloWorld::HelloWorld(const std::string& configFilename):dtABC::Application(configFilename),mText(0),mOrbitMotionModel(0)
                        {
                        // Generating a default config file if the one passed in is not there.

                        if(osgDB::findDataFile(configFilename).empty())
                        

                        {
                        GenerateDefaultConfigFile();
                        }
                        }
                        HelloWorld::~HelloWorld()
                        {
                        }

                        void HelloWorld::Config()
                        {
                        // Allocate a dtCore::Object. This class will be your basic container
                        // for 3D meshes.
                        mText = new dtCore::Object("Text");
                        // Load the model file, in this case a OpenFligth model (.flt)
                        mText->LoadFile("HelloWorld.flt");
                        // Add the Object to the scene. Since mText is a RefPtr, we must
                        // pull the internal point out to pass it to the Scene.
                        GetScene()->AddDrawable( mText.get() );
                        // Adjust the Camera position by instantiating a transform object to
                        // store the camera position and attitude.
                        dtCore:: Transform camPos;
                        camPos.SetLookAt( 0.0f, -100.0f, 20.0f, // Position
                        0.0f, 0.0f, 0.0f, // Look At
                        0.0f, 0.0f, 1.0f); // Up Vector
                        GetCamera()->SetTransform(camPos);
                        // Setting a motion model for the camera

                        mOrbitMotionModel = new dtCore::OrbitMotionModel(GetKeyboard(),GetMouse());

                        // Setting the camera as a target for the motion model. The object (the hello
                        // world 3D text) will be static at 0,0,0 and the camera will move using
                        // the right clicked mouse.
                        mOrbitMotionModel->SetTarget(GetCamera());
                        }

                        int main()
                        {
                        // Setup the data file search paths for the config file and the models files.
                        // This is best done in main prior to configuring app. That way the paths
                        // are ensured to be correct when loading data.
                        dtCore::SetDataFilePathList( ".;" + dtCore::GetDeltaDataPathList());

                        // Instantiate the application and look for the config file
                        // You do not have to call delete on this.
                        dtCore::RefPtr<HelloWorld> app = new HelloWorld( "config.xml" );
                        // Configure the application
                        app->Config();
                        // Run the simulation loop
                        app->Run();

                        return 0;
                        

                        }

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #15

                        And the HelloWorld.h code?

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                        T 1 Reply Last reply
                        0
                        • C CPallini

                          And the HelloWorld.h code?

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                          T Offline
                          T Offline
                          T RATHA KRISHNAN
                          wrote on last edited by
                          #16

                          #include <dtABC/application.h>
                          #include <dtCore/refptr.h>

                          // Forward declarations to keep compile-time down
                          namespace dtCore
                          {
                          class Object;
                          class OrbitMotionModel;
                          }

                          class HelloWorld: public dtABC::Application
                          {
                          public:
                          HelloWorld(const std::string &configFilename);

                          protected:
                          // Destructors for subclasses of dtCore::Base must have a protected
                          // destructor. Otherwise use of RefPtrs will cause some serious
                          // problems if the objects are allocated on the stack.

                           virtual ~HelloWorld();
                          

                          public:
                          // Override this function to setup your scene.

                           virtual void Config();
                          

                          private:
                          // dtCore::RefPtr is a template for a smart pointer that takes
                          // care of reference counting for objects allocated on the heap.
                          // It is good practice to store all objects that derive from
                          // dtCore::Base inside a RefPtr.

                           dtCore::RefPtr<dtCore::Object> mText;
                           dtCore::RefPtr<dtCore::OrbitMotionModel> mOrbitMotionModel;
                          

                          }

                          C S 2 Replies Last reply
                          0
                          • T T RATHA KRISHNAN

                            #include <dtABC/application.h>
                            #include <dtCore/refptr.h>

                            // Forward declarations to keep compile-time down
                            namespace dtCore
                            {
                            class Object;
                            class OrbitMotionModel;
                            }

                            class HelloWorld: public dtABC::Application
                            {
                            public:
                            HelloWorld(const std::string &configFilename);

                            protected:
                            // Destructors for subclasses of dtCore::Base must have a protected
                            // destructor. Otherwise use of RefPtrs will cause some serious
                            // problems if the objects are allocated on the stack.

                             virtual ~HelloWorld();
                            

                            public:
                            // Override this function to setup your scene.

                             virtual void Config();
                            

                            private:
                            // dtCore::RefPtr is a template for a smart pointer that takes
                            // care of reference counting for objects allocated on the heap.
                            // It is good practice to store all objects that derive from
                            // dtCore::Base inside a RefPtr.

                             dtCore::RefPtr<dtCore::Object> mText;
                             dtCore::RefPtr<dtCore::OrbitMotionModel> mOrbitMotionModel;
                            

                            }

                            C Offline
                            C Offline
                            CPallini
                            wrote on last edited by
                            #17

                            Well, I cannot spot the error. The code seems OK. Anyway, I insist, the right place for #include "HelloWorld.h" is at the bottom of the list. :)

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                            1 Reply Last reply
                            0
                            • T T RATHA KRISHNAN

                              I didn't miss any ';' at all. Infact it's system(Simulation Engine's) file. What to do? Here is the complete code for globals.h.

                              #ifndef DELTA_GLOBALS
                              #define DELTA_GLOBALS

                              #include <string>

                              #include <dtCore/export.h>

                              namespace dtCore
                              {
                              /// Set the list of data file paths
                              DT_CORE_EXPORT void SetDataFilePathList( const std::string& pathList );

                              /// Get the list of data file paths
                              DT_CORE_EXPORT std::string GetDataFilePathList();

                              /// Get the Delta Data path list (equivalent to the DELTA_DATA environment)
                              DT_CORE_EXPORT std::string GetDeltaDataPathList();

                              /// Get the root path to Delta3D (equivalent to the DELTA_ROOT environment)
                              DT_CORE_EXPORT std::string GetDeltaRootPath();

                              /// Convienence method to get the supplied environment variable
                              DT_CORE_EXPORT std::string GetEnvironment(const std::string& env );

                                DT\_CORE\_EXPORT void SetEnvironment(const std::string& name, const std::string& value);
                              
                               DT\_CORE\_EXPORT std::string FindFileInPathList(const std::string &fileName);
                              

                              }

                              #endif //DELTA_GLOBALS

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #18

                              Where is line 29 at? That's the one that eventually caused the compiler to complain?

                              "Love people and use things, not love things and use people." - Unknown

                              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                              1 Reply Last reply
                              0
                              • T T RATHA KRISHNAN

                                #include <dtABC/application.h>
                                #include <dtCore/refptr.h>

                                // Forward declarations to keep compile-time down
                                namespace dtCore
                                {
                                class Object;
                                class OrbitMotionModel;
                                }

                                class HelloWorld: public dtABC::Application
                                {
                                public:
                                HelloWorld(const std::string &configFilename);

                                protected:
                                // Destructors for subclasses of dtCore::Base must have a protected
                                // destructor. Otherwise use of RefPtrs will cause some serious
                                // problems if the objects are allocated on the stack.

                                 virtual ~HelloWorld();
                                

                                public:
                                // Override this function to setup your scene.

                                 virtual void Config();
                                

                                private:
                                // dtCore::RefPtr is a template for a smart pointer that takes
                                // care of reference counting for objects allocated on the heap.
                                // It is good practice to store all objects that derive from
                                // dtCore::Base inside a RefPtr.

                                 dtCore::RefPtr<dtCore::Object> mText;
                                 dtCore::RefPtr<dtCore::OrbitMotionModel> mOrbitMotionModel;
                                

                                }

                                S Offline
                                S Offline
                                super_ttd
                                wrote on last edited by
                                #19

                                you're missing a ; after the closing } of the class definition. a class definition is like this :

                                class C {
                                //...
                                }**;**


                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups