如何修复Visual Studios中的“不允许导入dllimport函数的定义”错误

时间:2019-04-09 22:32:17

标签: c++ visual-studio opencv dllimport dllexport

使用LiveScan3D。尝试编译服务器以从多个kinect相机生成网格。我们可以编译使用kinect相机的客户端,但是服务器遇到错误。

我们尝试将BUILD_DLL放入预处理器定义中以尝试解决该错误,但我相信它最终掩盖了该问题。

这是错误开始的地方

extern "C" DEPTH_PROCESSING_API void __stdcall generateVerticesFromDepthMap(unsigned char* depth_maps,
    unsigned char *depth_colors, int *widths, int *heights, float *intr_params, float *wtransform_params, Mesh *out_mesh,
    float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int depth_map_index)

{
    int depth_pos = 0, colors_pos = 0;

    vector<VerticesWithDepthColorMaps> vertices_with_maps(1);

    IntrinsicCameraParameters intrinsic_params;
    WorldTranformation world_transform;
    vector<vector<TriangleIndexes>> triangle_indexes(1);

    intrinsic_params = IntrinsicCameraParameters(intr_params + depth_map_index * 7);
    world_transform = WorldTranformation(wtransform_params + depth_map_index*(9 + 3));

    for (int i = 0; i < depth_map_index; i++)
    {
        depth_pos += widths[i] * heights[i] * sizeof(unsigned short);
        colors_pos += widths[i] * heights[i] * sizeof(unsigned char) * 3;
    }

    createVertices((unsigned short*)(depth_maps + depth_pos), depth_colors + colors_pos, widths[depth_map_index], 
        heights[depth_map_index], intrinsic_params, world_transform, 
        std::ref(vertices_with_maps[0]), minX, minY, minZ, maxX, maxY, maxZ);

    formMesh(out_mesh, vertices_with_maps, triangle_indexes);
}

这是我不断收到的错误:

  

C:\ Users \ Baker \ Downloads \ LiveScan3D-master \ LiveScan3D-master \ src \ NativeUtils \ depthprocessing.cpp(1634):错误C2491:'generateVerticesFromDepthMap':dllimport函数的定义不允许

我希望服务器可以编译而不会出现此错误。

0 个答案:

没有答案