Embedded SQL 실습 중 헤더파일 오류입니다. 0 1 2,137

by 도르앰 [MySQL] [2020.06.04 01:23:55]


#include
#include
#include
#include
#include

int main() {
    SQLHENV hEnv;
    SQLHDBC hDbc;
    SQLHSTMT hStmt;
    SQLRETURN ret = SQL_SUCCESS;

    SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv);
    SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, SQL_IS_INTEGER);
    SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc);
    ret = SQLConnect(hDbc, (SQLCHAR*)"VENDINGMACHINE", SQL_NTS, (SQLCHAR*)"", SQL_NTS, (SQLCHAR*)"", SQL_NTS);
    ret = SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt);

    if ((ret != SQL_SUCCESS) && (ret != SQL_SUCCESS_WITH_INFO))
        printf("Connection:fail\n");
    else
        printf("Connection:success\n");

    return 0;
}

위와 같은 코드를 작성하여 ODBC에 추가한 DB에 연결하려고 합니다.

그 과정에서 컴파일 시 계속

1>------ 빌드 시작: 프로젝트: DB, 구성: Debug Win32 ------
1>소스.cpp
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(151,40): error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(151,33): error C2146: 구문 오류: ';'이(가) 'SQLHWND' 식별자 앞에 없습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(289,16): error C3646: 'Data1': 알 수 없는 재정의 지정자입니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(289,16): error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(290,15): error C3646: 'Data2': 알 수 없는 재정의 지정자입니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(290,15): error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(291,15): error C3646: 'Data3': 알 수 없는 재정의 지정자입니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(291,15): error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(292,15): error C3646: 'Data4': 알 수 없는 재정의 지정자입니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(292,15): error C2143: 구문 오류: ','이(가) '[' 앞에 없습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(292,20): error C2143: 구문 오류: ')'이(가) ';' 앞에 없습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h(292,20): error C2238: ';' 앞에 예기치 않은 토큰이 있습니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\windef.h(39,1): error C2040: 'HWND': 'HWND__ *'의 간접 참조 수준이 'int'과(와) 다릅니다.
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqlext.h(1790,24): error C2061: 구문 오류: 식별자 'SQLHWND'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqlucode.h(336,25): error C2061: 구문 오류: 식별자 'SQLHWND'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqlucode.h(761,21): error C2061: 구문 오류: 식별자 'SQLHWND'
1>"DB.vcxproj" 프로젝트를 빌드했습니다. - 실패
========== 빌드: 성공 0, 실패 1, 최신 0, 생략 0 ==========
 

위와 같은 에러가 발생하여 이렇게 질문 드립니다..

아직 많이 모자라고 배워가는 과정이라 이런 기초적인 질문드려서 죄송합니다..

by 도르앰 [2020.06.04 13:43:54]

해결했습니다.. 헤더파일에도 순서가 있는지는 처음 알았네요.. 

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입