class exporting error (error C2470: looks like a function definition)
I can't export a class:
#ifndef SDBIDI
#define SDBIDI
#ifndef SDBIDI_FLAG
#define SDBIDI_ORIENT __declspec(dllimport)
#else
#define SDBIDI_ORIENT __declspec(dllexport)
#endif
#include "TCInfoSuVars.h" //class is here!
SDBIDI_ORIENT int myFoo(FILE *file); // exporting function
#endif
class definition in TCInfoSuVars.h
#pragma on开发者_开发百科ce
#include <string>
#include <hash_map>
class SDBIDI_ORIENT TCInfoSuVars
{
public:
std::string id;
std::string tcVal;
TCInfoSuVars();
TCInfoSuVars(std::string _tcVal, std::string _id);
~TCInfoSuVars();
};
Getting a error:
myProgram.cpp
#define SDBIDI_FLAG
output:
TCInfoSuVars.h(14) : error C2470: 'TCInfoSuVars' : looks like a function definition, but there is no parameter list; skipping apparent body
And if I write
class __declspec(dllexport) TCInfoSuVars
everything works OK.
Thank you!
Somewhere you're including TCInfoSuVars.h
before SDBIDI_ORIENT
is defined - Make sure you include the header file that defines SDBIDI_ORIENT
first.
精彩评论