coin-or / Cbc

COIN-OR Branch-and-Cut solver
Other
814 stars 115 forks source link

Help~for run cbc examples #614

Open wozhendeshuai opened 1 year ago

wozhendeshuai commented 1 year ago

Hello, I am a beginner in C++and would like to run relevant examples in CBC locally. My operating environment is as follows: OS: Mac OS Editor: VScode When I directly run examples/mimum.cpp in VSCode, the following error occurs: minimum.cpp:5:10: fatal error: 'CbcModel.hpp' file not found

include

     ^~~~~~~~~~~~~~

1 error generated. When I enter the following command on the console: cd "/Users/XXX/solvers/Cbc/examples/"&&g++minimum. cpp - I "/usr/local/include/coin or" - o minimum&&"/Users/XXX/solvers/Cbc/examples/" minimum The following error will occur: Undefined symbols for architecture arm64: "OsiClpSolverInterface::OsiClpSolverInterface()", referenced from: _main in minimum-712299.o "OsiClpSolverInterface::~OsiClpSolverInterface()", referenced from: _main in minimum-712299.o ld: symbol(s) not found for architecture arm64

wozhendeshuai commented 1 year ago

/solvers/Cbc/.vscode/c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/src/**",
                "/usr/local/include/**",
                "/usr/local/include/coin-or/**"
            ],
            "defines": [],
            "macFrameworkPath": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "macos-gcc-arm64"
        }
    ],
    "version": 4
}

/solvers/Cbc/.vscode/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": "debug",
        "type": "cppdbg",
        "request": "launch",
        "program": "/usr/local/bin/cbc", // file location
        "args": [
        ],
        "stopAtEntry": true,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb",
        "preLaunchTask": "CBC install"
    }
    ]
}

/solvers/Cbc/.vscode/settings.json

/solvers/Cbc/.vscode/tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "CBC install",
            "command": "make",
            "args": [
                "install"
            ],
            "dependsOn": "CBC make",
            "options": {
                "cwd": "${workspaceFolder}"
            }
        },
        {
            "type": "cppbuild",
            "label": "CBC make",
            "command": "make",
            "args": [
            ],
            "dependsOn": "CBC configure",
            "options": {
                "cwd": "${workspaceFolder}"
            }
        },
        {
            "type": "cppbuild",
            "label": "CBC configure",
            "command": "source",
            "args": [
                "${workspaceFolder}/.vscode/script.sh"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            },
        }
    ]
}