My c++ code about stl_list is complied with warning :" '__p' might be used uninitialized in this function " under the circumstance where "codeblocks-8.02mingw-setup.exe" is installed.
However,the warnings no longer exist if I install "codeblocks-8.02-setup.exe" and MinGW separately,thus I guess it's C::B's integration problem because I even tried to replace the "MinGW" folder and "mingwm10.dll" under codeblocks program directory.
Here's my code(in the attachment)
[attachment deleted by admin]
Your code is syntactically correct (though you really should be using const references as function parameters in several places). Possibly this is a problem with the old verdion of GCC that comes with the CB release version. If using a later version of GCC fixes the problem, as seems to be the case, I don't think you have anything to worry about.
Well,then did you notice I said "I even tried to replace the "MinGW" folder and "mingwm10.dll" under codeblocks program directory"?
I replaced the default MinGW folder and "mingwm10.dll" inside "codeblocks-8.02mingw-setup.exe" with the "correct-compile-result" MinGW folder and "mingwm10.dll",still warnings...
You said:
However,the warnings no longer exist if I install "codeblocks-8.02-setup.exe" and MinGW separately,
so I'm a bit confused as to what your problem is - are you still getting warnings or not? And which version of MinGW are you installing separately?
On my local machine,I installed "codeblocks-8.02mingw-setup.exe";
On my Virtual PC 2007(virtual WinXP guest),I installed "codeblocks-8.02-setup.exe" and MinGW separately,and the MinGW version is "MinGW-5.1.6.exe" from http://sourceforge.net/projects/mingw/files/;
Then I deleted the folder "C:\Program Files\CodeBlocks\MinGW" on my local machine,copied "C:\MinGW"(virtual machine) to "C:\Program Files\CodeBlocks\MinGW"(local machine),and replaced "C:\Program Files\CodeBlocks\mingwm10.dll"(local machine) with "C:\MinGW\bin\mingwm10.dll"(virtual machine) as well.
Warnings never occur on the virtual machine and never disappear on the local one.
Try to compare compiler settings (Settings -> Compiler and Debugger ...) in both enviroments. I think there will be differences in some optimalization flags.
Warnings never occur on the virtual machine and never disappear on the local one.
So your problems are regarding virtualisation. It might have been a good idea to mention that in your original question, and I think you probably need to ask this in a forum that concerns itself with that topic.
Quote from: koso on October 12, 2009, 06:35:34 PM
Try to compare compiler settings (Settings -> Compiler and Debugger ...) in both enviroments. I think there will be differences in some optimalization flags.
Great Answer!
I deselected the "-O" on my local machine,the code is then compiled fine,I guess it's a problem of gcc.
But I accidently discovered a small mistake of "codeblocks-8.02mingw-setup.exe" after comparison:
In the "Toolchain executables" tab,"Make program" is set to "make.exe" by default while there's no such file in MinGW's directory,but "mingw32-make.exe" instead,like the one auto-detected on my virtual machine.