(bug C2470: looks like a function definition)

I can not export the 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 once #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 error:

myProgram.cpp

 #define SDBIDI_FLAG 

exit:

 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 is working fine.

Thanks!

+8
c ++ class visual-studio-2005
source share
1 answer

Somewhere you turn on TCInfoSuVars.h before SDBIDI_ORIENT is defined. Be sure to include the header file that defines SDBIDI_ORIENT .

+12
source share

All Articles