Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:33:37+00:00 2026-06-13T17:33:37+00:00

Trying to compile and run a simple Allegro program using Sublime Text 2 and

  • 0

Trying to compile and run a simple Allegro program using Sublime Text 2 and SublimeClang. If I run g++ '/path/to/project/main.cpp' -o '/path/to/project/main' -I/usr/include/allegro5 -L/usr/lib -lallegro on the command line, it compiles fine.

Contents of C++.sublime-build

{
    "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' $(pkg-config --libs allegro-5.0)"]
        }
    ]
}

The run fails and the output of Sublime Console is:

Running bash -c g++ '/path/to/project/main.cpp' -o '/path/to/project/main' && '/path/to/project/main' -I/usr/include/allegro5 -L/usr/lib -lallegro

It seems that Sublime is adding && '/path/to/project/main', even though the build settings don’t specify to do that. What is causing Sublime to add this && '/path/to/project/main'? And how do I remove it?

In the bigger picture – this means Allegro will be linked in all C++ projects even if the libraries aren’t being used. Is there a way to add the Allegro flags globally on my system? Sorry, not usually a C++ dev.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:33:38+00:00Added an answer on June 13, 2026 at 5:33 pm

    I solved my own issue. I used backticks instead of the $() notation:

    "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' `pkg-config --libs allegro-5.0` && ./${file_base_name}"]
    

    Notice I also added && ./${file_base_name} – which runs the program too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just trying to compile and run a very simple test program, but
I'm trying to compile a simple c++ program to run inside ESXi 3.5 console
I am trying to run a simple ruby program on windows platform using 'tk'
I am trying to get a very simple program to compile while using functions
I am trying to compile and run a simple java class within eclipse. The
Having this errors when trying to compile/run my app using Maven. I've succeeded to
I am trying to compile a project to run on an ARM board that
I am trying to compile and run a simple tutorial for an Objective C
I am trying to run a simple shell command that runs and returns text
I am trying to make a simple c# program using Growl C# API .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.