diff --git a/NEWS.md b/NEWS.md index 422bae9c..847c99f5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ Red Panda C++ Version 1.1.0 - enhancement: when ctrl+mouse cursor hovered an identifier or header name, use underline to highlight it - enhancement: mark editor as modified, if the editing file is changed by other applications. - enhancement: When the editing files is changed by other applications, only show one notification dialog for each file. + - fix: c files added to a project will be compiled as c++ file. Red Panda C++ Version 1.0.10 - fix: modify watch doesn't work diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index 4bf3dec5..70054c89 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -466,7 +466,7 @@ QString Compiler::getLibraryArguments(FileType fileType) int waitCount = 0; //wait parsing ends, at most 1 second while(parser->parsing()) { - if (waitCount>0) + if (waitCount>10) break; waitCount++; QThread::msleep(100); diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index 5bf1db73..33f7cf37 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -278,13 +278,27 @@ PProjectUnit Project::newUnit(PProjectModelNode parentNode, const QString& custo false, parentNode)); newUnit->node()->unitIndex = count; //parentNode.Expand(True); - newUnit->setCompile(true); - if (getFileType(customFileName) == FileType::CSource) { + switch(getFileType(customFileName)) { + case FileType::CSource: + newUnit->setCompile(true); newUnit->setCompileCpp(false); - } else { + newUnit->setLink(true); + break; + case FileType::CppSource: + newUnit->setCompile(true); + newUnit->setCompileCpp(true); + newUnit->setLink(true); + break; + case FileType::WindowsResourceSource: + newUnit->setCompile(true); newUnit->setCompileCpp(mOptions.isCpp); + newUnit->setLink(false); + break; + default: + newUnit->setCompile(false); + newUnit->setCompileCpp(false); + newUnit->setLink(false); } - newUnit->setLink(true); newUnit->setPriority(1000); newUnit->setOverrideBuildCmd(false); newUnit->setBuildCmd(""); @@ -976,7 +990,7 @@ PProjectUnit Project::addUnit(const QString &inFileName, PProjectModelNode paren switch(getFileType(inFileName)) { case FileType::CSource: newUnit->setCompile(true); - newUnit->setCompileCpp(mOptions.isCpp); + newUnit->setCompileCpp(false); newUnit->setLink(true); break; case FileType::CppSource: