Hi
i try to do something like that:
#define PATH "mydir"
#include "PATH/myfile.h"
I would like to compiler to do :
#include "mydir/myfile.h"
But it doesn't work :)
And i can't find a way to make it work...
Is it a way?
thanks you very much
(Note: i don't want to just add the path to 'standard include path', i
really want to have it working the way i said above, if it's possible of
course :) ) 4 2564
mr wrote:
Hi
i try to do something like that:
#define PATH "mydir"
#include "PATH/myfile.h"
I would like to compiler to do :
#include "mydir/myfile.h"
But it doesn't work :)
And i can't find a way to make it work...
Is it a way?
You can do something like:
#define FILE "mydir/myfile.h"
#include FILE
I don't know if concatenation of string literals works in #include
directives, like:
#define PATH "mydir"
#include PATH "/myfile.h"
You could do string concatenation in the preprocessor with ##.
But what you are asking cannot be done, since #include is
also a preprocessor command and the #include parameter
will not be changed by the preprocessor.
--
Papastefanos Serafeim
Ï "mr" <mr*****@ifranc e.comÝãñáøå óôï ìÞíõìá
news:44******** *************** @news.free.fr.. .
Hi
i try to do something like that:
#define PATH "mydir"
#include "PATH/myfile.h"
I would like to compiler to do :
g
#include "mydir/myfile.h"
But it doesn't work :)
And i can't find a way to make it work...
Is it a way?
thanks you very much
(Note: i don't want to just add the path to 'standard include path', i
really want to have it working the way i said above, if it's possible of
course :) )
mr ha escrito:
Hi
i try to do something like that:
#define PATH "mydir"
#include "PATH/myfile.h"
I would like to compiler to do :
#include "mydir/myfile.h"
But it doesn't work :)
And i can't find a way to make it work...
Is it a way?
thanks you very much
(Note: i don't want to just add the path to 'standard include path', i
really want to have it working the way i said above, if it's possible of
course :) )
I think your compiler has a "add include directory" command. In gcc:
gcc -I/home/heltena/src/myIncludeDir module.c
( _i_, not L)
And, when I try to compile this:
#include <joseph.h>
int main() { return 0; }
The compiler looks for a "joseph.h" file in "/usr/include" (and others
standard directories) and then it tries
"/home/heltena/src/myIncludeDir".
bye!
Papastefanos Serafeim wrote:
You could do
See below.
Brian
--
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.c om/c++-faq-lite/how-to-post.htm> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: s |
last post by:
Can I do this:
#define MYSTRING "ABC"
..
..
..
char mychar = MYSTRING;
..
..
..
|
by: kUfa.scoopex |
last post by:
Hi there!
I have a small problem, and i really dont see any convenient way to fix it.
Basically, i'd like to overload global new operators, into something like
this:
void *operator new( size_t size );
void *operator new( size_t size, AllocationType allocType );
void *operator new( size_t size, MemoryHandler* memHandler );
void *operator new( size_t size, MemoryHandler* memHandler, AllocationType
|
by: Bryan Parkoff |
last post by:
"#define" can only be inside the global scope before main() function.
"#if" can be tested after "#define" is executed. The problem is that
"#define" can't be inside main() function. I do not wish to create multiple
functions which they look almost identical in C++ source code. The C++
compiler should be able to compile one Test() function into two almost
identical functions before they are translated into the machine language
object. ...
|
by: psundara |
last post by:
Hi,
I'm facing a peculiar problem of finding a way to interpret header
information in a smart way.
I have this header file that is shared by many users, which contains,
among things, a few #define statements that associate GUIDs wih a
friendly name. For e.g. consider the file zoo.h:
....
|
by: Andreas |
last post by:
Hi!
I'm using an IplImage library from camellia.sourceforge.net, and the
testbench calls a file only containing code like the one below. In
cam_morphomaths_code.c the real computation is made, but I don't
understand where cam_morphomaths_code.c is included and how to set
what parameters to use in the testbench.
How does this code execure? I don't understand a bit...
| |
by: FBM |
last post by:
Hi,
I am preparing project for submission and i'd like to allow the print
out of debug messages. I know that with something like
#define DEBUG
#ifdef DEBUG
print(X);
#endif
|
by: iler.ml |
last post by:
I am writing code that uses two third-party libraries.
They both define same macro OP_ENCRYPT, and
luckily for me, they both define it to 0. (In one include,
it's '#define OP_ENCRYPT 0', in another include it's 0x0).
I cannot change contents of those two includes.
This generates comipler warning 'macro redefined'. It's easy
to suppress the warning with #ifdef. But I want to also
cross-check that those two macros have same value.
I am...
|
by: David T. Ashley |
last post by:
Where is the best place to define TRUE and FALSE?
Are they in any of the standard include files, ever?
Do any standards apply?
What I've traditionally done is something like:
#ifndef (TRUE)
#define TRUE (1)
|
by: anirbid.banerjee |
last post by:
Hi,
I need to write a macro which would have a lot many conditional
#ifdef ... #endif blocks in it.
#define _xx_macro (x) {
... \
... \ /* some code (); */
#ifdef _SOME_STMT \
... \
... \
|
by: MoslyChang |
last post by:
Hi, All
When I look at effective c++,item2 and item3.
I have some basic questions , Does anyone be familar with this topic?
it suggests const is perfer to #define, then I think how to
replace #define with const.
example:
2 header file StringGrid1.h StringGrid2.h
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |