다음 코드를 컴파일하려고 할 때 컴파일 오류가 발생합니다.C에서 MySQL로 테스트 데이터베이스 만들기
#include "my_global.h"
#include "mysql.h"
int main(void)
{
MYSQL *conn;
conn = mysql_init(NULL);
if (conn == NULL) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_real_connect(conn, "localhost", "zetcode",
"passwd", NULL, 0, NULL, 0) == NULL) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_query(conn, "create database testdb")) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
mysql_close(conn);
return 0;
}
나는 다음과 같은 코드를 컴파일하려면 Windows 7 볼랜드 32 비트 컴파일러를 사용하고 있습니다. Win32에서 저작권에 대한
볼랜드 C++ 5.5.1 (C) 1993, 2000 볼랜드 creatingTESTDB.c : W8017 경고
내 명령은 내가 여섯 컴파일 오류가 점점 오전이c:\Borland\BCC55>bcc32 -Ic:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2 -win32-vs2005\include -c creatingTESTDB.c
같은 외모를 컴파일 c : \ Users \ osho \ Desktop \ mysql-connector-c-noinstall-6.0.2-win32-vs20 05 \ include \ config-win.h 111 : S_IRWXU의 재정의가 이 아닙니다.
오류 E2238 c : \ Users \ osho \ Desktop \ mysql-connector-c-noin stall-6.0.2-win32-vs2005 \ include \ config-win.h 114 : 'mode_t'에 대한 다중 선언
오류 E2344 c : \ Borland \ Bcc55 \ include \ sys/types.h 35 : 이전 선언 'mod e_t'
오류 E2141 c : \ Users \ osho \ Desktop \ mysql-connector-c-noinstall-6.0.2-win32-vs2005 \ include \ config-win.h 265 : 함수의 선언 구문 오류 double2ulonglong
오류 E2378 c : \ Users \ osho \ Desktop \ mysql-connector-c-noinstall-6.0.2-win32-vs2005 \ include \ config-win.h 268 : return 문이 누락되었습니다. 기능에 double2ulonglo NG
오류 E2293 C : \ 사용자 \ 오쇼 \ 바탕 화면 \ MySQL의 커넥터-C-noinstall-6.0.2-win32에서-VS2005 \는 \ my_global.h 1591 포함) 기능 RINT 예상
오류 E2293 C : \ 사용자 \ 오쇼 \ 바탕 화면 \ MySQL의 커넥터-C-noinstall-6.0.2-win32에서-VS2005 \는 \ my_global.h 1595 포함) 기능 RINT 예상
* 6 오류의를 컴파일 *
어떤 도움도 크게 감사하겠습니다. 테드. 다음 코드를 컴파일 할 때 컴파일 오류가 발생합니다.
#include "my_global.h"
#include "mysql.h"
int main(void)
{
MYSQL *conn;
conn = mysql_init(NULL);
if (conn == NULL) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_real_connect(conn, "localhost", "zetcode",
"passwd", NULL, 0, NULL, 0) == NULL) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_query(conn, "create database testdb")) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
mysql_close(conn);
return 0;
}
나는 다음과 같은 코드를 컴파일하려면 Windows 7 볼랜드 32 비트 컴파일러를 사용하고 있습니다.
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
creatingTESTDB.c:<br> Warning W8017
c:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2-win32-vs20
05\include\config-win.h 111: Redefinition of 'S_IRWXU' is not
identical<br><br> Error E2238
c:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2-win32-vs2005
\include\config-win.h 114: Multiple declaration for 'mode_t'<br><br>
Error E2344 c:\Borland\Bcc55\include\sys/types.h 35: Earlier
declaration of 'mod e_t'<br><br> Error E2141
c:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2-win32-vs2005
\include\config-win.h 265: Declaration syntax error in function
double2ulonglong<br><br> Error E2378
c:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2-win32-vs2005
\include\config-win.h 268: Return statement missing ; in function
double2ulonglo ng<br><br> Error E2293
c:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2-win32-vs2005
\include\my_global.h 1591:) expected in function rint<br><br> Error
E2293
c:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2-win32-vs2005
\include\my_global.h 1595:) expected in function rint<br><br>
*** 6 errors in Compile ***
가 어떻게이 문제를 해결할 수 : 컴파일 내 명령은 내가 여섯 컴파일 오류가 점점 오전이
c:\Borland\BCC55>bcc32 -Ic:\Users\osho\Desktop\mysql-connector-c-noinstall-6.0.2
-win32-vs2005\include -c creatingTESTDB.c
처럼 보인다?
나는 mysql5.5.20 버전의 mysql.After를 사용하여 my_sys.h를 포함하여 오류를 수정하지 않았습니다. 나는 링크를 통해 갔지만 유닉스 시스템에서는 gcc 대신 윈도우와 볼랜드 컴파일러를 사용하고있다. 가능한 한 더 많은 정보를 제공한다. –