Page 1 of 1

C++ Build Fails - Inspite of 0 errors / 0 Warnings

Posted: Sun Jan 09, 2022 3:40 am
by codebugs

I am doing a Udemy course - Beginning C++ Programming. I am new to CodeLite. I'm using version 15.0.0 on Windows 10 Pro Version 10.0.19043 Build 19043. I was running Codelite on a virtual machine (also Windows Pro) without any problems for the first 6 sections of the course. Suddenly, Codelite wouldn't run anymore at all. So, I decided to reinstall on the source machine. After several reinstalls, I finally got everything working again. Then, 2 days ago, I tried to run a simple project with variables and it just would not work. Here is the code and the build log:

Code: Select all

#include <iostream>
using namespace std;

int main( )
{
    int smRooms {0};
    int lgRooms {0};
    const double smCost {25};
    const double lgCost {35};
    const double tax {0.06};
    const int valid {30};
    
cout << "Hello! Welcome to Frank's Carpet Cleaning Service." << endl; cout << "\nHow many small rooms would you like cleaned? " << endl; cin >> smRooms; cout << "\nAnd how many large rooms?" << endl; cin >> lgRooms; double subSmall = smRooms * smCost; double subLarge = lgRooms * lgCost; double subRooms = subLarge + subSmall; double subTax = subRooms * tax; double Estimate = subRooms + subTax; cout << "The subtotal for " << smRooms << " small rooms and " << lgRooms << " large rooms is $" << subRooms << ". The sales tax will be $" << subTax << "." << endl; cout << "\nThe Estimate for the job will be $" << Estimate << ". This estimate is valid for " << valid << " days." << endl; return 0; }

C:\Windows\system32\cmd.exe /C ""C:/Program Files/MinGW-64/bin/mingw32-make.exe" -j4 SHELL=cmd.exe -e -f Makefile"

"----------Building project:[ Section6Challenge - Debug ]----------"

mingw32-make.exe[1]: Entering directory 'C:/Users/confi/Documents/CodeLite/Section6/Section6Challenge'

"C:/Program Files/MinGW-64/bin/g++.exe" -o Debug/Section6Challenge @"Section6Challenge.txt" -L. -static

C:/Program Files/MinGW-64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file Debug/Section6Challenge.exe: Permission denied

collect2.exe: error: ld returned 1 exit status

mingw32-make.exe[1]: *** [Section6Challenge.mk:81: Debug/Section6Challenge] Error 1

mingw32-make.exe: *** [Makefile:5: All] Error 2

mingw32-make.exe[1]: Leaving directory 'C:/Users/confi/Documents/CodeLite/Section6/Section6Challenge'

====0 errors, 0 warnings====[/size]

I was able to run the projekt without problems on OnlineGDB.com.
I thought the problem was caused by the antivirus program, but I disabled the program and I am still having problems. It's not consistent - sometimes the projects run, sometimes they don't, but the error message is always the same....cannot open output file Debug/projectname.exe: Permission denied.

Now something really weird just happened. I ran the project again, to double check and this time, it runs but not as written AND with the same error messages. I have attached screenshots of the run. Notice how the cout statements in the output don't match the code.

Screenshot Section6Challenge_1.png
Screenshot Section6Challenge_2.png

Thanks for any help.


Re: C++ Build Fails - Inspite of 0 errors / 0 Warnings

Posted: Sun Jan 09, 2022 10:26 pm
by codebugs

Addendum to Post:

Today I deleted the antivirus program completely and so far, everything is running properly.