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

  • Home
  • SEARCH
  • 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 6757721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:41:18+00:00 2026-05-26T13:41:18+00:00

I’ve got a scons build using a simple, common directory setup: project/ SConstruct src/

  • 0

I’ve got a scons build using a simple, common directory setup:

project/
    SConstruct
    src/
        file.cpp
        SConscript
    include/
        namespace/
            header.h

In file.cpp, I include header.h via #include “namespace/header.h” so what I want to do is simply add the include directory to the include path list. From the source (and SConscript) point of view, that path is “../include” but the build command always has an invalid path for the include in it. I’ve tried the following in the SConscript:

env.Append(CPPPATH = ["#include"])
env.Append(CPPPATH = [Dir("include")])
env.Append(CPPPATH = [os.getcwd() + os.sep + ".." + os.sep + "include"])
env.Append(CPPPATH = ["../include"])
env.Append(CPPPATH = ["#../include"])

none of which seem to work. The first four give “-Iinclude” while the last puts the include at the directory level above project! Here’s the full SConscript

env = Environment()
import os

target_name = "device"

source_files = Split("""
file.cpp
""")

env.Append(CPPPATH = ["#include", os.environ.get("SYSTEMC_PATH"),
    os.environ.get("SYSTEMC_TLM_PATH"), os.environ.get("BOOST_PATH")])

object_list = env.SharedObject(source = source_files)
targetobj = env.SharedLibrary(target = target_name, source = object_list )
Default(targetobj)

And the SConstruct is just:

import sys

SConscript('src/SConscript', variant_dir='Release-'+sys.platform, duplicate=0, exports={'MODE':'release'})
SConscript('src/SConscript', variant_dir='Debug-'+sys.platform, duplicate=0, exports={'MODE':'debug'})

I’m running scons from the directory where the SConstruct is located (i.e. the top level directory).

I’ve done some looking and according to the scons doco, the # is supposed to tell scons to generate the path from the current directory of the SConscript (which is the src directory) – I’m assuming this is instead of the SConstruct directory??? Further, I can’t see any questions out there about this particular problem (on this site or via Google in general), usually I’m just hitting people asking for scons scripts for exactly the setup I’ve got already (which is to add “include” to the CPPPATH).

Any thoughts on where this is going awry?

  • 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-05-26T13:41:19+00:00Added an answer on May 26, 2026 at 1:41 pm

    ‘#’ is relative to the top-level SConstruct, as per the SCons manual http://scons.org/doc/HTML/scons-user/x3240.html

    The scripts you provide above build successfully when I recreate the tree you specify. Here’s the working output:

    scons: Reading SConscript files ...
    scons: done reading SConscript files. 
    scons: Building targets ... 
    g++ -o Release-cygwin/file.os -c -Iinclude src/file.cpp 
    g++ -o Release-cygwin/device.dll -shared Release-cygwin/file.os 
    g++ -o Debug-cygwin/file.os -c -Iinclude src/file.cpp 
    g++ -o Debug-cygwin/device.dll -shared Debug-cygwin/file.os 
    scons: done building targets.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported

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.