Code::Blocks Forums

User forums => Help => Topic started by: Sasha on December 16, 2020, 05:17:30 pm

Title: Unidentified wanrning
Post by: Sasha on December 16, 2020, 05:17:30 pm
Why CB Old Version compiles the following code Successfully with warning on line #8

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    vector <string> strings(7);
    strings[4] = "Busted...";
    cout << strings[4] << endl;
    return 0;
}
Title: Re: Unidentified wanrning
Post by: sodev on December 16, 2020, 06:36:46 pm
That screenshot is from Eclipse :P

Posting the warning message might also help...
Title: Re: Unidentified wanrning
Post by: oBFusCATed on December 16, 2020, 07:39:34 pm
Because:
1. You're using different compiler.
2. You're using different set of command line arguments.
Title: Re: Unidentified wanrning
Post by: omlk on December 16, 2020, 08:21:05 pm
C      https://www.tulane.edu/~mpuljic/cpp/savitch/chapter11 (https://www.tulane.edu/~mpuljic/cpp/savitch/chapter11)
C++ https://www.softwaretestinghelp.com/cpp-string-array (https://www.softwaretestinghelp.com/cpp-string-array/)
Title: Re: Unidentified wanrning
Post by: Sasha on December 19, 2020, 05:26:47 pm
Thank you for correcting me, the warning occurred in Eclipse and in CB also, I have updated to the next old version on windows XP, and everything works fine.