Używam Visual Studio Code który nie pokazuje mi warningów, jestem na Linuxie (Elementary OS) program z warningiem który kompiluje:
#include <bits/stdc++.h>
using namespace std;
int funkcja_ktora_powoduje_warning(){
int x = 2137;
//powinienem zwracac int a nie zwracam nic, wiec powinien pojawic sie warning
}
int main(){
std::ios_base::sync_with_stdio(0);
std::cin.tie(NULL);
int x;
funkcja_ktora_powoduje_warning();
return 0;
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [
"-g",
"-o",
"main",
"main.cpp",
"-Wall",
"-static",
"-Wextra",
"-Wshadow",
"-Wconversion",
"-O3",
"-Wunreachable-code",
"-Wswitch-default",
"-Werror"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++ build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
tasks.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"-Wall",
"-Wextra",
"-Wshadow",
"-O2",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "Generated task by Debugger"
},
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"-Wall",
"-Wextra",
"-Wshadow",
"-O2",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "Generated task by Debugger"
},
{
"type": "cppbuild",
"label": "C/C++: cpp build active file",
"command": "/usr/bin/cpp",
"args": [
"-g",
"-Wall",
"-Wextra",
"-Wshadow",
"-O2",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Generated task by Debugger"
}
],
"version": "2.0.0"
}
settings.json
{
"files.associations": {
"valarray": "cpp"
}
}