Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory #43417

Open
244916896 opened this issue Jan 23, 2025 · 7 comments · May be fixed by #43421
Open

fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory #43417

244916896 opened this issue Jan 23, 2025 · 7 comments · May be fixed by #43421
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@244916896
Copy link

Operating system

Windows

Compiler

MSVC

Steps to reproduce the behavior

{
  "dependencies": [
    {
      "name": "curl",
      "features": [
        "ssh"
      ]
    },
    "fmt",
    "libssh2",
    "redis-plus-plus",
    {
      "name": "sqlpp11",
      "features": [
        "mysql",
        "sqlite3"
      ]
    },
    "mysql-connector-cpp"
  ]
}

Failure logs

[build] E:\develop\candcpp\cmakedemo\out\build\vs2022_x64\vcpkg_installed\x64-windows-static-md\include\sqlpp11/mysql/sqlpp_mysql.h(29,10): fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory

Additional context

Host Environment

Host: x64-windows
Compiler: MSVC 19.31.31106.2
vcpkg-tool version: 2024-11-12-eb492805e92a2c14a230f5c3deb3e89f6771c321
vcpkg-scripts version: b2cb0da 2024-11-15 (9 weeks ago)

@244916896 244916896 added the category:port-bug The issue is with a library, which is something the port should already support label Jan 23, 2025
@jimwang118
Copy link
Contributor

Please provide the cmakelists.txt and simple cpp you used for testing.

@244916896
Copy link
Author

int main()
{
std::cout << PROJECT_SOURCE_DIR << std::endl;

// -------------------------------------------mysql示例-------------------------------------------

auto config = std::make_shared<sqlpp::mysql::connection_config>();
config->user = "root";
config->password = "zhanghl";
config->database = "db";
config->host = "127.0.0.1";
config->port = 3306;
config->debug = true;
mysql::connection db(config);

db.execute("CREATE TABLE IF NOT EXISTS test_table (id INTEGER PRIMARY KEY, name VARCHAR(255))");

db.execute("INSERT INTO test_table (id, name) VALUES (1, 'Kimi')");
return 0;

}

@244916896
Copy link
Author

add_executable(${TGT} ${DIR_SRCS})

target_compile_definitions(${TGT} PRIVATE -DPROJECT_SOURCE_DIR="${CMAKE_SOURCE_DIR}")

set_target_properties(${TGT} PROPERTIES LINKER_LANGUAGE CXX)

[cmake] sqlpp11 provides CMake targets:

[cmake]

[cmake] find_package(Sqlpp11 CONFIG REQUIRED COMPONENTS MySQL)

[cmake] target_link_libraries(main PRIVATE sqlpp11::mysql)

find_package(fmt CONFIG REQUIRED)
target_link_libraries(${TGT} PRIVATE fmt::fmt)

find_package(Sqlpp11 CONFIG REQUIRED COMPONENTS MySQL)
target_link_libraries(${TGT} PRIVATE sqlpp11::mysql)

@jimwang118 jimwang118 linked a pull request Jan 23, 2025 that will close this issue
7 tasks
@jimwang118
Copy link
Contributor

Can you post your C++ code? I don't know which header files you referenced.

@244916896
Copy link
Author

I change this:#include <mysql/mysql.h>,cmake successed!
but build error
:[build] E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\vcpkg_installed\x64-windows-static-md\include\sqlpp11/mysql/bind_result.h(325,51): error C2589: “(”:“::”右边的非法标记 [E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\cvv\src\ssqlpp11\test\ssqlpp11_test.vcxproj]
[build] E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\vcpkg_installed\x64-windows-static-md\include\sqlpp11/mysql/bind_result.h(325): error C2062: 意外的类型“unknown-type” [E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\cvv\src\ssqlpp11\test\ssqlpp11_test.vcxproj]
[build] E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\vcpkg_installed\x64-windows-static-md\include\sqlpp11/mysql/bind_result.h(325,1): error C2059: 语法错误:“)” [E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\cvv\src\ssqlpp11\test\ssqlpp11_test.vcxproj]
[build] E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\vcpkg_installed\x64-windows-static-md\include\sqlpp11/mysql/bind_result.h(326,1): error C2143: 语法错误: 缺少“;”(在“{”的前面) [E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\cvv\src\ssqlpp11\test\ssqlpp11_test.vcxproj]
[build] E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\vcpkg_installed\x64-windows-static-md\include\sqlpp11/mysql/bind_result.h(326,90): error C2143: 语法错误: 缺少“;”(在“}”的前面) [E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\cvv\src\ssqlpp11\test\ssqlpp11_test.vcxproj]
[proc] 命令“"C:\Program Files\CMake\bin\cmake.EXE" --build E:/develop/candcpp/cmakedemo/out/build/cmakemsvcvcpkg --config Debug --”已退出,代码为 1
[driver] 生成完毕: 00:00:07.613

@244916896
Copy link
Author

above error code :
std::numeric_limits::max()
std::numeric_limits::max()
such as error to many
“unknown-type” [E:\develop\candcpp\cmakedemo\out\build\cmakemsvcvcpkg\cvv\src\ssqlpp11\test\ssqlpp11_test.vcxproj]MSVC(C2062)
template<> class std::numeric_limits

@244916896
Copy link
Author

help me! thinks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants