compilation

How to run a Python project using __pycache__ folder?

北慕城南 提交于 2019-12-18 17:55:44
问题 I want to run a Pythonic project using Python compilation ( .pyc or __pycache__ ). In order to do that in Python2 , I haven't any problem. Here is a simplified example in a Python2 project: Project tree: test2 ├── main.py └── subfolder ├── __init__.py └── sub.py Compile: python -m compileall test2 Project tree after the compile: test2 ├── main.py ├── main.pyc └── subfolder ├── __init__.py ├── __init__.pyc ├── sub.py └── sub.pyc As you can see, several .pyc manually generated. Now I can run

GCC: Compiling an OpenCL host on Windows

北城以北 提交于 2019-12-18 17:29:12
问题 I just wanted to try out using OpenCL under Windows. Abstract : I got an " undefined reference to " error when I tried to compile (using the command gcc my.o -o my.exe -L "C:\Program Files (x86)\AMD APP\lib\x86_64" -l OpenCL ). My Code #include <CL/cl.h> #include <stdio.h> int main(void) { cl_platform_id platform; int err; err = clGetPlatformIDs(1, &platform, NULL); if(err < 0) { perror("There's No Platform!"); exit(1); } /* Some more code... */ system("PAUSE"); } Makefile all: addition

Compile Swift script with static Swift core library

耗尽温柔 提交于 2019-12-18 15:49:46
问题 I would like to execute a compiled Swift script on a computer which doesn't have Swift installed. But it seems by default the Swift Compiler uses dynamically linked libraries. Is it possible to include these libraries statically? Steps to reproduce using Docker: user@host:~# docker run -it swiftdocker/swift root@16974ad4edb1:/# swift --version Swift version 3.0-dev (LLVM dffa09ffd8, Clang 9f0d189820, Swift 1c720b8f84) Target: x86_64-unknown-linux-gnu root@16974ad4edb1:/# echo 'print("Hello,

Compile Swift script with static Swift core library

若如初见. 提交于 2019-12-18 15:49:07
问题 I would like to execute a compiled Swift script on a computer which doesn't have Swift installed. But it seems by default the Swift Compiler uses dynamically linked libraries. Is it possible to include these libraries statically? Steps to reproduce using Docker: user@host:~# docker run -it swiftdocker/swift root@16974ad4edb1:/# swift --version Swift version 3.0-dev (LLVM dffa09ffd8, Clang 9f0d189820, Swift 1c720b8f84) Target: x86_64-unknown-linux-gnu root@16974ad4edb1:/# echo 'print("Hello,

Should I put many functions into one file? Or, more or less, one function per file?

半城伤御伤魂 提交于 2019-12-18 15:17:37
问题 I love to organize my code, so ideally I want one class per file or, when I have non-member functions, one function per file. The reasons are: When I read the code I will always know in what file I should find a certain function or class. If it's one class or one non-member function per header file, then I won't include a whole mess when I include a header file. If I make a small change in a function then only that function will have to be recompiled. However, splitting everything up into

Setting environment variables in pre-build event and using in compilation step

ぃ、小莉子 提交于 2019-12-18 14:54:31
问题 In Visual Studio 2003, I am trying to set an environment variable in the pre-build event that will then be used in the compilation step, but the value doesn't seem to be propagated. For example, if the pre-build event contains this (either directly or within a batch file): set MY_LIB_VERSION=1.0.0 and AdditionalIncludeDirectories has this: c:\path\to\library\my_lib_v$(MY_LIB_VERSION)\include then I would expect the compilation to work if the my_lib_v1.0.0 directory exists. But instead, I get

What do the numbers mean in the preprocessed .i files when compiling C with gcc?

99封情书 提交于 2019-12-18 13:59:35
问题 I am trying to understand the compiling process. We can see the preprocessor intermediate file by using: gcc -E hello.c -o hello.i or cpp hello.c > hello.i I roughly know what the preprocessor does, but I have difficulties understanding the numbers in some of the lines. For example: # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "hello.c" # 1 "/usr/include/stdio.h" 1 3 4 # 27 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 374 "/usr/include/features.h" 3 4

Cython for a Django app: would it work?

三世轮回 提交于 2019-12-18 13:17:46
问题 Would compiling with cython work with a python 3.4 Django app, or could it be made to work without a huge amount of effort? This answer - https://stackoverflow.com/a/7347168/805141 - to a question about protecting python code prompted me to ask this question. A similar question has been asked previously but with regards to improving performance: Using Cython with Django. Does it make sense? 回答1: Yes, we have done it. But it point of consistent pain. We make a commercial product which is

Unable to locate the Javac Compiler

北城以北 提交于 2019-12-18 13:08:09
问题 I tried to mvn install and got this message: Compilation failure Unable to locate the Javac Compiler in: /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required). In most cases you can change the location of your Java installation by setting the JAVA_HOME environment variable. Well, there is an open jdk, I also downloaded another one. I tried to point JAVA_HOME to both, now it is set:

VS 2010 error - cannot open file “iostream”

家住魔仙堡 提交于 2019-12-18 12:56:09
问题 I've just migrated from VS2005 to VS2010 and it fails to compile a simple program. #include <iostream> using std::cout; using std::endl; int main() { cout << "Hello Visual Studio 2010 :)" << endl; } Errors - 1 error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. 2 IntelliSense: cannot open source file "iostream" 3 IntelliSense: name followed by '::' must be a class or namespace name 4 IntelliSense: name followed by '::' must be a class or namespace name 5