compilation

Java: Is method name/signature resolution done statically (compile-time)?

余生长醉 提交于 2020-04-10 04:17:29
问题 I encountered an interesting problem today which I thought was not possible in Java. I compiled my java code against version 2.6 of jgroups but used version 2.12 at runtime (tomcat web app deployment). I got the following error org.jgroups.Message.<init>(Lorg/jgroups/Address;Lorg/jgroups/Address;Ljava/io/Serializable;) Assuming that the API would have change since then, I thought of porting my code to jgroups-2.12, but to my surprise the code compiled fine with jgroups-2.12 and when I

Difference between compiled and interpreted languages?

浪子不回头ぞ 提交于 2020-04-07 11:02:12
问题 What are the relative strenghts and weaknesses of compiled and interpreted languages? Why? 回答1: Neither approach has a clear advantage over the other - if one approach was always better, chances are that we'd start using it everywhere! Generally speaking , compilers offer the following advantages: Because they can see all the code up-front, they can perform a number of analyses and optimizations when generating code that makes the final version of the code executed faster than just

compiling BASIS on MSYS2 using MinGW-w64

倖福魔咒の 提交于 2020-03-25 12:30:13
问题 I'm trying to follow these instructions to compile-install BASIS (CMake Build system And Software Implementation Standard) on MSYS2 using MinGW-w64 compilers. However, the ccmake .. step fails: -bash: ccmake: command not found I tried searching the MSYS2 packages by pacman -Ss ccmake with no results. So I thought I have to use commandline cmake instead: cmake -DCMAKE_INSTALL_PREFIX:PATH=~/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON .. which failed by: CMake Error at src/cmake

How to compile and run in single command in java

情到浓时终转凉″ 提交于 2020-03-22 10:48:30
问题 I want to compile and run in the single command line. Usually, we first compile and after the run? javac example.java java example can I run this, javac example.java && java example 回答1: You can use a function : Myfunction() { javac $1.java && java $1 ; } The use : Myfunction example This question is duplicated , please to search before posting See : Compile and build with single command line Java (Linux) Regards 回答2: Since Java 11 you can use a single command java example.java https:/

Dynamically compile java code which has dependencies on classes loaded by specific classloader

泪湿孤枕 提交于 2020-03-20 06:36:47
问题 We have an ability to compile java code dynamically on the fly. I know at least Java-Runtime-Compiler and InMemoryJavaCompiler But seems they cannot compile class which depends on some class from certain classloader. Is it possible to dynamically compile java code which depends on classes available only in specific classloader? Let's say: ClassLoader classloader = ... // only this CL can load class 'com.External' String source = "public class MyClass extends com.External {}"; Class<?>

How exactly does linking work?

北慕城南 提交于 2020-03-17 05:00:25
问题 The way I understand the compilation process: 1) Preprocessing: All of your macros are replaced with their actual values, all comments are removed, etc. Replaces your #include statements with the literal text of the files you've included. 2) Compilation: Won't drill down too deep here, but the result is an assembly file for whatever architecture you are on. 3) Assembly: Takes the assembly file and converts it into binary instructions, i.e., machine code. 4) Linking: This is where I'm confused

How to tell if `constexpr` is evaluated at compile time (without manual inspection)

被刻印的时光 ゝ 提交于 2020-03-16 08:57:20
问题 Is there a standard way to find out what the compiler does to constexpr functions? (Side note: For debug, every constexpr function is deferred to runtime by default. Why is this sensible? Is there a way to influence this?) For release it depends on the context. Obviously, for small test settings you can easily inspect the generated machine code, but this cannot be the way to go for a real project. My current 'workaround' (VC++) is to break somewhere, go to my constexpr function and (try to)

Strange Python compilation results with “--enable-shared” flag

随声附和 提交于 2020-03-14 07:41:10
问题 I am using Debian (which comes with Python-2.7.3), trying to compile Python-2.7.6 from source for use with mod_wsgi alongside Apache. Apparently you must use --enable-shared when compiling for mod_wsgi usage, according to numerous answers. Following these steps: ./configure --enable-shared --prefix=/usr/local/bin/python-2.7.6 make make install And then checking the interactive shell @ /usr/local/bin/python-2.7.6/bin/python I am greeted with "Python 2.7.3 (default, Jan 2 2013, 14:09:21)" etc

How to specify multiple source directory for Android library project

大城市里の小女人 提交于 2020-03-13 05:29:30
问题 I am using ant tool to build android library project, I need to specify multiple source directory . I have tried to specify multiple source directory by adding these lines alternatively in ant.properties file source.dir=src:src2 source.dir=src;src2 but unable to build in both case, in both the cases .class were generated , but while creating jar file i was getting this error BUILD FAILED C:\Program Files\Android\android-sdk\tools\ant\build.xml:681: The following error occurred while executing

why does cmake compiles everything after git commit

你。 提交于 2020-03-04 06:50:18
问题 Lets say I have a code compiling at some time with cmake 2.8 on linux. I change a file "my_changed_file", run cmake, and only this one file is built. So far so good. Now i want to commit this: git add my_changed_file git commit If I run cmake again, i'd expect nothing happens. But all my files are recompiled, despite I didn't touched anything! The timestamp appears to be untouched when I do ls -l. I do have these lines: execute_process( COMMAND git describe --abbrev=8 --dirty --always --tags