Search code examples
phpc++php-cpp

Error while compiling php-cpp main.cpp file


I'm using php-cpp to create an extension for my php codes and when I try to compile just the simple structure of main.cpp file, I get this error.this is the compile errors:

main.cpp:15:5: error: ‘PHPCPP_EXPORT’ does not name a type
 PHPCPP_EXPORT void *get_module() 

and this is the code that I try to compile:

extern "C" {
int main(){}    

PHPCPP_EXPORT void *get_module() 
{
    static Php::Extension myExt("myExt", "0.9.3.20");        
    return myExt;
}
}

Solution

  • You have missed the #include <phpcpp.h> command.