error C3646 : unknown override specifier - c++

I'm trying to create a class network that you can create a network with parameters like the network ip.. and I want to pass also some nodes like the number of notebook, so on the network constructor I can create an array of notebook type, but it show me the following error , I don't know why,
please be patient I'm a beginner :C
I'll paste the essential code so if you need more for understand the issue I'll write to you, thanks.
class Network:
#pragma once
#include <iostream>
#include "Node.h"
#include "IpAdress.h"
using namespace std;
class Network{
protected:
NoteBook _notebook[100];
}
class Notebook:
#pragma once
#include <iostream>
#include "Node.h"
#include "IpAdress.h"
using namespace std;
class NoteBook : public Node {
public:
NoteBook() : Node() {
_networkAdress = IpAdress();
_hostAdress = IpAdress();
_powerState = false;
}
}
error C3646 :'_notebook': unknown override specifier
it also show me strange errors to to the line:" NoteBook _notebook[100];":
syntax error: ','missing before '['
syntax error: ','missing before '['
syntax error: ')' missing before ';'
unexpected token before ';'

Related

missing type specifier - int assumed. Note c++ does not support default-int

Getting this error along with an error stating that the variables "managers", "stores" "products", and inventory" are undeclared and there are missing ';' before them.
#include "Manager Info Structure.h"
#include "pch.h"
#include <iostream>
#include <string>
#include <fstream>
#include <array>
using namespace std;
//Vendor Variables
int VENDORSIZE = 3;
ManagerData managers[3];
the structure is listed here:
#pragma once
struct ManagerData
{
int man_iD;
string man_fname;
string man_lname;
int store_num;
int exp_mon;
int exp_year;
string man_phone;
string man_email;
};
edit: removed superfluous information, attempting the put pch.h at the top of the solution results in 3 instances of the error listed in the title of this post along with 'man_fname': unknown override specifier, 'man_lname': unknown override specifier, 'man_phone': unknown override specifier, 'man_email': unknown override specifier. Thank you everyone for your answers so far
You are most probably missing a ; after definition of one of the mentioned structs.

Clang++: weird error message

I try to compile a simple class, but I always get the same error:
≥ clang++ LIF_network.cpp -std=c++11
LIF_network.cpp:3:1: error: expected unqualified-id
public LIF_network::LIF_network(){
^
1 error generated.
.hpp:
#ifndef LIF_NETWORK_HPP
#define LIF_NETWORK_HPP
#include <vector>
#include <cstdlib>
#include "LIF_neuron.hpp"
#include "currentTimer.hpp"
#define MAX_TIME 15
class LIF_network{
public:
LIF_network();
};
#endif //LIF_NETWORK_HPP
.cpp:
#include "LIF_network.hpp"
public LIF_network::LIF_network(){
mNumNeurons = 0;
mNeurons = std::vector<std::vector<LIF_neuron>>();
mOutput = std::vector<double>();
mCurrentTimer = CurrentTimer(MAX_TIME, mNumNeurons);
}
The error message does not really help me. Can you spot my mistake? Thanks a lot!
The access specifier (public: private: and protected:) only works within a class definition and not outside of it. It looks like you are trying to port Java code.

inheritance from within a namespace error

I have the following piece of code:
#include <pcl/recognition/ransac_based/model_library.h>
#include <pcl/common/common.h>
#include <pcl/features/shot.h>
namespace pcl
{
class LSDPointPairModelLibrary : public ModelLibrary
{ ... }
}
I am getting the error:
expected class-name before '{' token
I also tried qualifying the superclass like so: pcl::recognition::ModelLibrary but I get the error pcl::recognition has not been declared
Atn least you must provide the sub-namespace recognition, but pcl::recognition should also work. Did you not forget the semicolon at the end of the class definition? You could try ::pcl::recognition::ModelLibrary to make sure you start from the top level namespace.

Vs2012 compiler error C2143 : missing ; before *

With my luck it's probably something very obvious that's slipped past me, but I've been struggling with C2143 for quite a while and I'm stumped.
game.h(21): error C2143: syntax error : missing ';' before '*'
game.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Game.h
#ifndef GAME_H_
#define GAME_H_
#include <irrlicht.h>
using namespace irr;
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace irr::io;
using namespace irr::gui;
#include <iostream>
#include "CInput.h"
#include "CAssets.h"
using namespace rtsirr;
IrrlichtDevice *device = 0;
IVideoDriver *driver = 0;
ISceneManager *manager = 0;
CAssets *assets = 0; // Line 21, error here
#endif
CAssets.h
#ifndef ASSETS_H_
#define ASSETS_H_
#include "Game.h"
namespace rtsirr {
class CAssets
{
public:
CAssets();
virtual ~CAssets();
ITexture* getTexture(stringw name);
IMesh* getMesh(stringw name);
IAnimatedMesh* getAnimatedMesh(stringw name);
void load();
private:
map<stringw, ITexture *> *textures;
map<stringw, IMesh *> *meshes;
map<stringw, IAnimatedMesh *> *animatedMeshes;
};
}
#endif
It seems that CAssets isn't being recognized as a valid type, but I can't figure out why. What's causing the issue?
Thanks.
You have a cyclic dependency in your includes. Game.h includes CAssets.h which in turn includes Game.h before even getting to define CAssets. The result from the preprocessor would be different, depending on the order of includes.
From your sample code, it seems that Game.h doesn't really need to know much about CAssets other than that is a type. You could replace the inclusion of CAssets.h with a forward declaration:
class CAssets;
You can even provide a CAssets_fwd.h that does only that. Otherwise, you will need to break the cyclic dependency between those two headers.

syntax error : missing ';' before identifier 'iDlg'

I am trying to get a dialog box [import] to launch from another dialog box [baseline].
I am including the required ".h" files however I am simply not able to create an instance of the import class. The error I get is this:
Error 1 error C2146: syntax error : missing ';' before identifier 'iDlg' h:\shaunak\projects\sar_ccd\sar_ccd\baseline.h 202 1 Sar_CCD
The line of code that causes this [baseline.h]:
#include "Markup.h"
#include<stdio.h>
#include<math.h>
#include "baseline_func.h"
#include "resource.h"
#include "Functions.h"
#include <stdlib.h>
#include "Sar_CCDDoc.h"
#include "Sar_CCDView.h"
#include <vector>
#include "MemAlloc.h"
#include "ReadFiles.h"
#include<vector>
#include<map>
#include "afxwin.h"
#include "import.h"
#include "Geocode.h"
**<SNIP: Taking out the irrelevant lines>**
afx_msg void OnDestroy();
virtual void PostNcDestroy();
afx_msg void OnBnClickedNxtBase();
CButton nextBaseline;
import iDlg; //doesnt work!
CGeocoding cx; //works!!!
};
However, if I create and instance of another class [Geocoding] using the same sysntax like so, it works fine:
#include "Geocoding.h"
CGeocoding cx;
Please help me figure out why.
Full code:
baseline.h: http://freetexthost.com/on06wref6c
import.h: http://freetexthost.com/x4e4dkwrve
In Visual Studio there is a keyword import or #import rather used to import a COM DLL and is used for other things as well. I guess you are experiencing a name collision there.
In order to get around it place your class import in a namespace
import.h
namespace myimport
{
class import : public CDialog {
...
};
};
import.cpp
namespace myimport
{
...
};
then when you use it
myimport::import iDlg;
that should solve the issue, although renaming it to something else than "import" would be the better way to go.
import is not a keyword or type in C++. Therefore you get a syntax error because the compiler doesn't recognize import.
To create an instance of another class you have to properly declare it, e.g.:
class baseline : public CDialog
{
// ...
CDialog *iDlg; // Pointer to imported dialog
};
Remember to initialize the pointer to the actual dialog.