简体   繁体   中英

this declaration has no storage class or type specifier

I have a this declaration has no storage class or type specifier problem when implementing a C++ dll. Here is the code

CarPool.h code:

#pragma once
#define DllExport _extern "C" long __declspec(dllexport)

DllExport CartToPol(char* fileName, long imgWidth, long imgHeight, long bytePerPixel);
DllExport PolToCart(char* fileName, long imgWidth, long imgHeight, long bytePerPixel);

CarPool.cpp code

    // CarPool.cpp : Defines the exported functions for the DLL application.
    //

    #include "stdafx.h"
    #include "CarPool.h"

    DllExport CartToPol(char* fileName, long imgWidth, long imgHeight, long bytePerPixel)
    {
        return TRUE;
    }

DllExport PolToCart(char* fileName, long imgWidth, long imgHeight, long bytePerPixel)
{
    return TRUE;

}    

Anyone has any idea why? Thanks.

I found it, it was the underscore on extern.

It should be

#define DllExport extern "C" long __declspec(dllexport)

instead of

#define DllExport _extern "C" long __declspec(dllexport)

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM