首页 文章

C文件cfx_pmta.cxx将无法编译

提问于
浏览
-2

我正在尝试编译PMTA cfx_pmta.cxx文件,以便我可以进行一些更改,但在我进行任何更改之前,我无法进行编译 .

以下是文件的包含:

#if defined(sun)
    #define _POSIX_PTHREAD_SEMANTICS
#endif

#ifdef _WIN32
    #include <windows.h>
    #define strcasecmp _stricmp
    #define strncasecmp _strnicmp
    #if defined(UNIT_TEST)
        #define __dllexport
    #else
        #define __dllexport __declspec(dllexport)
    #endif
#else
    #define __dllexport
    #define __cdecl
#endif

#ifdef __unix__
    #include <signal.h>
    #include <errno.h>
#endif

#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#if defined _WIN32
    #include <time.h>   
#endif

#include "stdafx.h"
#include "cfx.h"

#include "include/submitter/PmtaMsg.h"
#include "include/submitter/PmtaConn.h"
#include "include/submitter/PmtaRcpt.h"

229错误C2079'tmp'使用未定义的类'std :: basic_ostringstream,std :: allocator>'

230错误C2297'<<':非法,右操作数的类型为'const char [9]'

230错误C3861'时间':未找到标识符

230警告C4552'<<':操作员无效;预期的操作员有副作用

231'.str'左侧的错误C2228必须具有class / struct / union

229     std::ostringstream tmp; 
230     tmp << "boundary" << time(0);
231     std::string boundary = tmp.str();

617错误C2079'f'使用未定义的类'std :: basic_ifstream>'

617错误C2440'初始化':无法从'const char *'转换为'int'

625'.read'左侧的错误C2228必须具有class / struct / union

626'.gcount'左侧的错误C2228必须具有class / struct / union

629'.close'左侧的错误C2228必须具有class / struct / union

621错误C4996'strerror':此功能或变量可能不安全 . 请考虑使用strerror_s . 要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS . 详细信息请参见在线帮助 .

604 void
605 attachFile(const std::string& boundary, const char* fileName) {
606     addBoundary(boundary);
607     addData("Content-Type: application/octet-stream\n");
608     addData("Content-Disposition: attachment; filename=\"");
609     addData(fileName);  addData("\"\n");
610     addData("Content-Transfer-Encoding: base64\n\n");
611
612     if (!PmtaMsgSetEncoding(_message, PmtaMsgENCODING_BASE64)) {
613         die("error setting base64 encoding", PmtaMsgGetLastError(_message));
614     }
615
616     char buffer[8192];
617     std::ifstream f(fileName);
618
619    if (!f) {
620        std::string error = std::string("error opening ") + fileName;
621        die(error, strerror(errno));
622    }
623
624    while (f) {
625        f.read(buffer, sizeof(buffer));
626        addData(buffer, static_cast<int>(f.gcount()));
627    }
628
629 f.close();
630
631    if (!PmtaMsgSetEncoding(_message, PmtaMsgENCODING_8BIT)) {
632        die("error setting 8-bit encoding", PmtaMsgGetLastError(_message));
633    }
634 }

736错误C4430缺少类型说明符 - 假定为int . 注意:C不支持default-int
736错误C2144语法错误:'void'前面应该是';'

733 //------------------------------------------------------------------------------
734 //  externally visible tag processor
735//------------------------------------------------------------------------------
736 extern "C" __dllexport void __cdecl
737 ProcessTagRequest(CCFXRequest* request) {
738     try {
739        TagProcessor proc(request);
740        proc.process();
741    }
742    catch (std::bad_alloc&) {
743        request->ThrowException(TAG_ERROR, "out of memory");
744    }
745    catch (char* text) {
746        // this may be thrown by some dummy classes
747        request->ThrowException(TAG_ERROR, text);
748    }
749    catch (CCFXException* e) {
750        request->ReThrowException(e);
751    }
752    catch (...) {
753    // original ColdFusion example comment:
754    // "Catch ALL other exceptions and throw them as Cold Fusion exceptions
755    // (DO NOT REMOVE! -- this prevents the server from crashing in case of
756    // an unexpected exception)"
757    request->ThrowException(TAG_ERROR, "Unexpected error occurred "\
758                             "while processing tag.");
759 }
760 };

任何帮助都会很棒!!只需要能够编译DLL然后我就可以进行所需的更改 .

此外,我不是一个C开发人员,所以试图让我的头围绕它,所以放轻松 .

2 回答

  • 0

    std :: cout是在 <iostream> 标头中定义的输出流 . 为了使用std :: string对象,您必须包含 <string> 标头

    尝试添加: #include<iostream> #include<string> 在您的cxx文件中 .

  • 0

    经过一些阅读后,我决定尝试命令行编译器,令我惊讶的是它编译得很好 .

    因此,如果有人对如何为PMTA重新编译cfx_pmta.cxx文件以更改Cold Fusion自定义标记代码感兴趣,请运行以下命令(显然更改路径以匹配您的文件位置

    cl /LD /MT /EHsc /IC:\path\api\include /IC:\ColdFusion8\include /D "_WIN32" C:\path\api\cfx_pmta.cxx /link C:\path\api\lib\pmta.lib ws2_32.lib advapi32.lib
    

相关问题