由於void *無法分配給類型爲char的實體* 16 應該如何處理解決錯誤。問題出現在xmlpath和dllPath中智能感知:無法將類型爲「void *」的值分配給類型爲「char *」的實體16
void fmuLoad() {
char* fmuPath;
char tmpPath[1000]="W:\\Prajwal\\GM_FMU_EXTRACT\\";
char* xmlPath;
char* dllPath;
const char *modelId;
FMU fmu;
fmuUnzip();
// parse tmpPath\modelDescription.xml
xmlPath = calloc(sizeof(char), strlen(tmpPath) + strlen(XML_FILE) + 1);
sprintf(xmlPath, "%s%s", tmpPath, XML_FILE);
fmu.modelDescription = parse(xmlPath);
free(xmlPath);
if (!fmu.modelDescription) exit(EXIT_FAILURE);
//printf(fmu.modelDescription);
#ifdef FMI_COSIMULATION
modelId = getAttributeValue((Element*)getCoSimulation(fmu.modelDescription),att_modelIdentifier);
//#else // FMI_MODEL_EXCHANGE
// modelId = getAttributeValue((Element *)getModelExchange(fmu.modelDescription), att_modelIdentifier);
#endif
// load the FMU dll
dllPath = calloc(sizeof(char), strlen(tmpPath) + strlen(DLL_DIR) + strlen(modelId) + strlen(".dll") + 1);
sprintf(dllPath, "%s%s%s.dll", tmpPath, DLL_DIR, modelId);
if (!loadDll(dllPath, &fmu)) {
exit(EXIT_FAILURE);
}
// free(dllPath);
// free(fmuPath);
// free(tmpPath);
}
不是功能,抱歉,但你可以看到dllPath = calloc **那裏顯示錯誤 – PrajwalBhat