C2143
-
what happens if you #include "HelloWorld.h" after every other system includes ?
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
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
-
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
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 -
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
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] -
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]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 cameramOrbitMotionModel = 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;
}
-
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 ClarkeHere 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 cameramOrbitMotionModel = 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;
}
-
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 cameramOrbitMotionModel = 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;
}
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 -
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#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;
}
-
#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;
}
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 -
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
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
-
#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;
}