Strict compiling

已回答

Hi, I'm new to c++ programming and is taking a course in the subject at the moment and is using CLion on mac. I have problems with the c++ 11 validation, the course implement the ANSI/ISO standard for C++ 11 (I don't really understand the full meaning of that but have a vague idea), I can for instance omit includes and use unsupported types without even a warning. My teacher use visual studio on windows and 50% of my submitted tasks fails because he can't compile them. I can for instance declare an unsigned int as an uint and omit includes of <algorithm> when using min function or <string> when using strings.

I have tried to make the compiling stricter by adding set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -Wextra -pedantic") to the CMakesList.txt but with no luck.

So my question is - is there a way to make the compiling stricter somehow?

Thanks

/ Peter

0

Unfortunately, it is the way C++ works - if, for example, any header you've included includes `<string>` by itself, you won't need to include it yourself (and this may vary across different STL implementations, e.g. Visual Studio vs. libc++). You might try to check your files with "Include what you use" tool, but there is no integration with CLion yet (please follow or upvote this feature request).

1

请先登录再写评论。