Dear NVIDIA Support Team,
I encountered a compilation error while attempting to compile the following CUDA code using nvcc in cuda_11.8.r11.8/compiler.31833905_0. The code is saved in UTF-8 encoding.
#pragma once
#include <string>
class Operator {
bool _compatibleMode = true;
protected:
template<typename T> void set(const std::string &key, const T &v) {
printf("尝试写入{}但它不可写");
}
int getID() {
this->set<bool>("1", "2");
return 0;
}
public:
Operator();
Operator(const Operator &other);
};
Below are the details of the error:
C:\Users\kohill\Desktop\aoi-demo-r\src\operators>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_86,code=\"sm_86,compute_86\" -gencode=arch=compute_60,code=\"compute_60,compute_60\" -gencode=arch=compute_60,code=\"sm_60,compute_60\" -gencode=arch=compute_61,code=\"compute_61,compute_61\" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_62,code=\"compute_62,compute_62\" -gencode=arch=compute_62,code=\"sm_62,compute_62\" -gencode=arch=compute_70,code=\"compute_70,compute_70\" -gencode=arch=compute_70,code=\"sm_70,compute_70\" -gencode=arch=compute_72,code=\"compute_72,compute_72\" -gencode=arch=compute_72,code=\"sm_72,compute_72\" -gencode=arch=compute_75,code=\"compute_75,compute_75\" -gencode=arch=compute_75,code=\"sm_75,compute_75\" -gencode=arch=compute_80,code=\"compute_80,compute_80\" -gencode=arch=compute_80,code=\"sm_80,compute_80\" -gencode=arch=compute_86,code=\"compute_86,compute_86\" -gencode=arch=compute_86,code=\"sm_86,compute_86\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" --keep-dir x64\RelWithDebInfo -maxrregcount=0 --machine 64 --compile -cudart static -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --Werror cross-execution-space-call --no-host-device-move-forward --expt-relaxed-constexpr --expt-extended-lambda -std=c++17 -Xcompiler="/EHsc -Zi -Ob1 /utf-8" -D_WINDOWS -DONNX_NAMESPACE=onnx_c2 -DNDEBUG -DWITH_PYTHON=1 -DQT_NO_KEYWORDS=1 -DWITH_LIBTORCH=1 -D_UNICODE -DUNICODE -DNOMINMAX -D_MATH_DEFINES_DEFINED -DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0 -DWITH_CUDA=1 -DZMQ_STATIC -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_WIDGETS_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_WCHAR_TO_UTF8_SUPPORT -DSPDLOG_WCHAR_FILENAMES -DUSE_DISTRIBUTED -DUSE_C10D_GLOO -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_SERIALBUS_LIB -DQT_SERIALPORT_LIB -DQT_MULTIMEDIA_LIB -DQT_SQL_LIB -D"CMAKE_INTDIR=\"RelWithDebInfo\"" -D_UNICODE -DUNICODE -DWIN32 -D_WINDOWS -DNDEBUG -DNOMINMAX -DWITH_PYTHON=1 -DQT_NO_KEYWORDS=1 -DWITH_LIBTORCH=1 -D_UNICODE -DUNICODE -D_MATH_DEFINES_DEFINED -DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0 -DWITH_CUDA=1 -DZMQ_STATIC -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_WIDGETS_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_WCHAR_TO_UTF8_SUPPORT -DSPDLOG_WCHAR_FILENAMES -DUSE_DISTRIBUTED -DUSE_C10D_GLOO -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_SERIALBUS_LIB -DQT_SERIALPORT_LIB -DQT_MULTIMEDIA_LIB -DQT_SQL_LIB -D"CMAKE_INTDIR=\"RelWithDebInfo\"" -Xcompiler "/EHsc /W3 /nologo /O2 /FS /Zi /MD /GR /utf-8" -o test.obj "main.cu"
main.cu
main.cu(7): error: missing closing quote
main.cu(8): error: expected a ")"
detected during instantiation of "void Operator::set(const std::string &, const T &) [with T=__nv_bool]"
(10): here
main.cu(8): error: expected a ";"
detected during instantiation of "void Operator::set(const std::string &, const T &) [with T=__nv_bool]"
(10): here
3 errors detected in the compilation of "main.cu".
The compilation command used is as follows:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_86,code=\"sm_86,compute_86\" -gencode=arch=compute_60,code=\"compute_60,compute_60\" -gencode=arch=compute_60,code=\"sm_60,compute_60\" -gencode=arch=compute_61,code=\"compute_61,compute_61\" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_62,code=\"compute_62,compute_62\" -gencode=arch=compute_62,code=\"sm_62,compute_62\" -gencode=arch=compute_70,code=\"compute_70,compute_70\" -gencode=arch=compute_70,code=\"sm_70,compute_70\" -gencode=arch=compute_72,code=\"compute_72,compute_72\" -gencode=arch=compute_72,code=\"sm_72,compute_72\" -gencode=arch=compute_75,code=\"compute_75,compute_75\" -gencode=arch=compute_75,code=\"sm_75,compute_75\" -gencode=arch=compute_80,code=\"compute_80,compute_80\" -gencode=arch=compute_80,code=\"sm_80,compute_80\" -gencode=arch=compute_86,code=\"compute_86,compute_86\" -gencode=arch=compute_86,code=\"sm_86,compute_86\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" --keep-dir x64\RelWithDebInfo -maxrregcount=0 --machine 64 --compile -cudart static -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --Werror cross-execution-space-call --no-host-device-move-forward --expt-relaxed-constexpr --expt-extended-lambda -std=c++17 -Xcompiler="/EHsc -Zi -Ob1 /utf-8" -D_WINDOWS -DONNX_NAMESPACE=onnx_c2 -DNDEBUG -DWITH_PYTHON=1 -DQT_NO_KEYWORDS=1 -DWITH_LIBTORCH=1 -D_UNICODE -DUNICODE -DNOMINMAX -D_MATH_DEFINES_DEFINED -DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0 -DWITH_CUDA=1 -DZMQ_STATIC -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_WIDGETS_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_WCHAR_TO_UTF8_SUPPORT -DSPDLOG_WCHAR_FILENAMES -DUSE_DISTRIBUTED -DUSE_C10D_GLOO -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_SERIALBUS_LIB -DQT_SERIALPORT_LIB -DQT_MULTIMEDIA_LIB -DQT_SQL_LIB -D"CMAKE_INTDIR=\"RelWithDebInfo\"" -D_UNICODE -DUNICODE -DWIN32 -D_WINDOWS -DNDEBUG -DNOMINMAX -DWITH_PYTHON=1 -DQT_NO_KEYWORDS=1 -DWITH_LIBTORCH=1 -D_UNICODE -DUNICODE -D_MATH_DEFINES_DEFINED -DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0 -DWITH_CUDA=1 -DZMQ_STATIC -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_WIDGETS_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_WCHAR_TO_UTF8_SUPPORT -DSPDLOG_WCHAR_FILENAMES -DUSE_DISTRIBUTED -DUSE_C10D_GLOO -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_SERIALBUS_LIB -DQT_SERIALPORT_LIB -DQT_MULTIMEDIA_LIB -DQT_SQL_LIB -D"CMAKE_INTDIR=\"RelWithDebInfo\"" -Xcompiler "/EHsc /W3 /nologo /O2 /FS /Zi /MD /GR /utf-8" -o test.obj "main.cu"
It’s worth mentioning that I have already used the -Xcompiler
option in the compilation parameters to specify the /utf-8
option for the Microsoft Visual C++ compiler.
I appreciate your assistance in resolving this matter. Please let me know if there are any additional compiler options or alternative solutions that I can try to ensure the successful compilation of my code while keeping it in UTF-8 encoding.
Thank you for your attention and support.