Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » How to determine if U++ is being utilized...
Re: How to determine if U++ is being utilized... [message #53456 is a reply to message #53418] Sat, 04 April 2020 02:50 Go to previous messageGo to previous message
ptkacz is currently offline  ptkacz
Messages: 89
Registered: March 2017
Member
Thanks Novo, to both your answers. I'm familiar with defining macros and making use of the logic directives (i.e. #if, etc). I was looking for something that could avoid having to manually make a macro definition, or prior inclusion, and then have to always make sure that things are defined or not when hopping from one application (project) to another.

After a little bit more digging on the web, it looks like C++17 has added to it for use with the marco pre-processor, a __has_include() function that checks if a header reference exists. Yesterday after updating my system, I tested out the following:

In TheIDE:
    #if __has_include("CtrlLib/CtrlLib.h")
        CtrlLayout(*this, "U++ Window title");
    #else
        CtrlLayout(*this, "U++ not here");
    #endif

and even,

In Code::Blocks:
    #if __has_include("iostream")
        cout << "iostream here." << endl;
    #else
        cout << "iostream not here" << endl;
    #endif

    #if __has_include("CtrlLib/CtrlLib.h")
        cout << "U++ Window here." << endl;
    #else
        cout << "U++ not here" << endl;
    #endif

__has_include() worked in all circumstances, so it looks like I'll have to be making C++17 for just this one feature.

Some additional information on it can be found here, https://en.cppreference.com/w/cpp/preprocessor/include

Again, thanks for your input!


Peter
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: umk static version
Next Topic: U++ does not appear to like playing nice with the Boost algorithm string library?
Goto Forum:
  


Current Time: Sat Jul 19 04:34:37 CEST 2025

Total time taken to generate the page: 0.06331 seconds