I cant compile a program because of settings.

已完成

I have a simple program that I am able to compile on online compilers and other PC's but due to some changes I made when trying vs I am no longer able to compile in clion 

ERROR CODE

C:\Users\harsh\CLionProjects\diagonal_array\main.cpp(16): error C2131: expression did not evaluate to a constant
C:\Users\harsh\CLionProjects\diagonal_array\main.cpp(16): note: failure was caused by a read of a variable outside its lifetime
C:\Users\harsh\CLionProjects\diagonal_array\main.cpp(16): note: see usage of 'n'
C:\Users\harsh\CLionProjects\diagonal_array\main.cpp(19): warning C4552: '>>': result of expression not used
C:\Users\harsh\CLionProjects\diagonal_array\main.cpp(26): warning C4552: '<<': result of expression not used
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx86\x86\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

0

Hello!

>I have a simple program that I am able to compile on online compilers and other PC's

Do you check the exactly same compilers that you use in CLion?

Also it's impossible to say anything without your project.

1

Thank you for writing but I had just discovered that it was a problem with my program rather than clion itself as I was using code::blocks and other online compilers I discovered that when initializing an array clion is particular that the variable being passed is global. while other compilers are not very particular about this. So all in all it was a mistake on my part and rather a coding error and I believe I should have tried the same compiler on a different machine. And again thank you for writing.

0

here in this error message when it says see the usage of n it really means that n should have been a global variable.

0

>I discovered that when initializing an array clion is particular that the variable being passed is global

Please note that CLion itself doesn't compile anything. This is a matter of the compiler specified in `File | Settings | Build, Execution, Deployment | Toolchains`.

0

Thanks for the info I am pretty new to this and still learning this has been a great help.

0

请先登录再写评论。