Tôi đã tình hình rất lạ sau đây ... Visual Studio của tôi biên dịch 2010 không thích đoạn mã sau:Visual Studio 2010 C++ biên dịch vấn đề
QStringList lst2 = instantiatedTableInstances.split(strComma, skipper);
for(int i=0; i<lst2.size(); i++)
{
TableInstance* tabInst= v->getTableInstance(lst2.at(i));
result->addInstantiatedTableInstance(tabInst);
}
nó mang lại cho tôi:
..\src\DeserializationFactory.cpp(1196) : error C2143: syntax error : missing ';' before 'constant'
..\src\DeserializationFactory.cpp(1196) : error C2440: '=' : cannot convert from 'QStringList' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
..\src\DeserializationFactory.cpp(1198) : error C2228: left of '.size' must have class/struct/union
type is 'int'
..\src\DeserializationFactory.cpp(1200) : error C2228: left of '.at' must have class/struct/union
type is 'int'
và một ảnh chụp màn hình:
NHƯNG nếu tôi đổi tên biến để lst
thay vì lst2
tất cả mọi thứ biên dịch ...
Đây có phải là một lỗi hài hước trong Visual Studio 2010 (vì GCC không quan tâm về điều đó) hoặc có một lý do ẩn hơn cho việc này?
Kiểm tra xem lst2 chưa được xác định/khai báo/macro trong phạm vi chưa. – user2672165
lst2 là macro. Từ ảnh chụp màn hình có vẻ như nó có màu sắc khác nhau, nên cho nó đi – relaxxx
Mẹo: Cố định bằng cách xác định 'WIN32_LEAN_AND_MEAN'. – MSalters