include-path

Best way to include file in PHP?

自闭症网瘾萝莉.ら 提交于 2019-11-29 15:00:44
问题 I'm currently developping a PHP web application and I would like to know what is the best manner to include files (include_once) in a way where the code it is still maintanable. By maintanable I mean that if I want to move a file, It'd be easy to refactor my application to make it work properly. I have a lot of files since I try to have good OOP practices (one class = one file). Here's a typical class structure for my application: namespace Controls { use Drawing\Color; include_once '/..

Library include paths with same header name

喜夏-厌秋 提交于 2019-11-29 11:26:32
问题 What is the best method to include a file that has same name in another folder from additional include directories? Example: lib1/include/foo.h lib2/include/foo.h where both lib1/include and lib2/include are added in additional include directories. Edit: The libs are from different SDK's and every developer installs them in his own place. Only thing that is sure is that both folders are in IDE's additional include paths method 1: #include "../../lib1/include/foo.h method2: Add lib1/include

Compiler fails to search “/usr/local/include” after updating to macOS Mojave

隐身守侯 提交于 2019-11-29 09:53:45
问题 After updating to macOS Mojave, the the OS fails to search for headers in /usr/local/include when compiling with clang++ ( from the command-line, i.e. outside Xcode ). Note that /usr/local/include is for my system the default paths in which CMake installs the headers, it thus feels quite strange of having to manually include this. Incidentally I have also performed a clean install, resulting in the same problem. In the latter I have, in the following order: Installed Xcode from the App-store.

Compile and link 3rd party library in Visual Studio [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-11-29 03:16:25
问题 This question already has an answer here: Compiling and linking third party libraries in VS 2015 [duplicate] 1 answer I am fairly new to C programming and I haven't used Visual Studio or a third party library before. I'm trying to do something simple with FMOD and need to link fmodvclib , fmod.h , and of course fmod.dll . I've put fmodex_vc.lib in the additional dependencies and the path to the low level libraries in the include and library directories as well as additional include libraries

calling include from an included file

孤者浪人 提交于 2019-11-29 01:04:53
So, examining this directory structure /include_one.php /include_two.php /directory/main_file.php Assume that I am in /directory/main_file.php and I call include('../include_one.php'); inside of include_one.php , to include include_two.php . Do I need to call include('include_two.php); or include('../include_two.php'); ? So my question is: When including a file, is the 'relative include path' shifted to the included file, or does it remain at the main including file? I am aware that the best alternative would be to have a config.php which contains the root_path, however this is not possible at

Eclipse C++ including header file from my source folder

﹥>﹥吖頭↗ 提交于 2019-11-28 20:33:34
问题 I'm pretty new to C++ and Eclipse in general so I apologise if I'm missing something fairly obvious. The problem I'm having is that I'm trying to include a header file in one of my source files but they're in different folders in my project directory. I have no idea how I should be including them. I've uploaded an image showing my problem with the header file I want to include highlighted. If someone could tell me what '#include' statement I should be using them that would be brilliant.

PHP how to find application root?

眉间皱痕 提交于 2019-11-28 19:15:01
I'm having problems with my include files. I don't seem to be able to figure out how to construct my URLs when I use require_once('somefile.php'). If I try to use an include file in more than one place where the directory structures are different, I get an error that the include file cannot be found. In asp.net, to get my application root path, I can use ~/directory/file.aspx. The tild forward slash always knows that I am referencing from my website root and find the file no matter where the request comes from within my website. It always refers back to the root and looks for the file from

Get calling file name from include()

允我心安 提交于 2019-11-27 21:36:58
I want to get the name of the file that includes another file from inside the included file. I know there is the __FILE__ magic constant, but that doesn't help, since it returns the name of the included file, not the including one. Is there any way to do this? Or is it impossible due to the way PHP is interpreted? This is actually just a special case of what PHP templating engines do. Consider having this function: function ScopedInclude($file, $params = array()) { extract($params); include $file; } Then A.php can include C.php like this: <?php // A.php ScopedInclude('C.php', array(

Cannot find corecrt.h: $(UniversalCRT_IncludePath) is wrong

梦想与她 提交于 2019-11-27 18:27:39
I've just installed Visual Studio 2015 on my working laptop with Windows 10. I've cloned a repository with a solution created with the same version of Visual Studio (update 3) on another PC, always with windows 10. When I try to build the solution on my laptop I obtain the following error: c:\program files (x86)\microsoft visual studio 14.0\vc\include\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory In this page I've read that I must add $(UniversalCRT_IncludePath) to my include paths, but even in this case I obtain the same error. I've checked

How to include file outside document root?

与世无争的帅哥 提交于 2019-11-27 12:50:16
What I want do to is to include 'file1.php' from 'domain1' into 'file2.php' on 'domain2'. So what I figured I should do is something like this: file2.php require_once '/var/www/vhosts/domain1/httpdocs/file1.php'; But this won't work for reasons I can't truly grasp. So what I did was to add my path to the include path. Something like: file2.php set_include_path(get_include_path() . PATH_SEPARATOR . "/var/www/vhosts/domain1/httpdocs"); require_once 'file1.php'; So can you please give me some hints as of where I'm doing wrong ? Thanks UPDATE - Either way I get the following error message: Fatal