compilation

How do I compile for 64bit using G++ w/ CodeBlocks?

↘锁芯ラ 提交于 2019-12-17 18:24:36
问题 I'm currently working on creating a shared lib DLL but I need to load it at runtime in a 64 bit environment so it currently doesn't work. How can I compile 64bit dlls from code blocks using g++ ? I've tried compiler options like -m64 but none seem to work. 回答1: To compile 64-bit programs on windows using g++, you need MinGW64. I believe that Code::Blocks comes with MinGW32. To install it onto Code::Blocks, extract the zip file to a folder without spaces, such as C:\MinGW64 Open Code::Blocks

Is there a way to precompile a regex in Perl?

柔情痞子 提交于 2019-12-17 18:22:11
问题 Is there a way to precompile a regex in Perl? I have one that I use many times in a program and it does not change between uses. 回答1: For literal (static) regexes there's nothing to do -- perl will only compile them once. if ($var =~ /foo|bar/) { # ... } For regexes stored in variables you have a couple of options. You can use the qr// operator to build a regex object: my $re = qr/foo|bar/; if ($var =~ $re) { # ... } This is handy if you want to use a regex in multiple places or pass it to

WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.6.16

亡梦爱人 提交于 2019-12-17 18:03:47
问题 This question was migrated from Super User because it can be answered on Stack Overflow. Migrated 8 years ago . I can’t work out why I’m getting this error from Nokogiri when I start up Rails. From the little I know, it seems like something else is causing an older version of libxml2 to be loaded, which Nokogiri then ends up using, rather than the version it was compiled against. What do I need to do to get this working without the warning (and with the right libxml2)? I’m running this on a

How can I build my C extensions with MinGW-w64 in Python?

眉间皱痕 提交于 2019-12-17 17:31:13
问题 So I have a few Python C extensions I have previously built for and used in 32 bit Python running in Win7. I have now however switched to 64 bit Python, and I am having issues building the C extension with MinGW-w64. I made the changes to distutils as per this post, but I am getting some weird errors suggesting something is wrong: $ python setup.py build running build running build_ext building 'MyLib' extension c:\MinGW64\bin\x86_64-w64-mingw32-gcc.exe -mdll -O -Wall -Ic:\Python27\lib\site

Build OpenVPN with specific OpenSSL version

陌路散爱 提交于 2019-12-17 16:37:48
问题 Similar questions have been asked before, but the answers no longer seem to apply as the flags have changed for the configure script. I am trying to compile OpenVPN from the git source on Ubuntu 14.04.5 on both x86 and x64. I have OpenSSL 1.0.1t built and installed to /usr/local/ssl. I've tried various combinations of the configure options and the compiler seems to recognize since ./configure OPENSSL_LIBS="-L/usr/local/ssl/ -lssl -lcrypto" OPENSSL_CFLAGS="-I/usr/local/ssl/include/" finishes

Is a C++ compiler allowed to emit different machine code compiling the same program?

不问归期 提交于 2019-12-17 16:36:21
问题 Consider a situation. We have some specific C++ compiler, a specific set of compiler settings and a specific C++ program. We compile that specific programs with that compiler and those settings two times, doing a "clean compile" each time. Should the machine code emitted be the same (I don't mean timestamps and other bells and whistles, I mean only real code that will be executed) or is it allowed to vary from one compilation to another? 回答1: The C++ standard certainly doesn't say anything to

Haskell program outputs `<<loop>>`

核能气质少年 提交于 2019-12-17 16:32:23
问题 I wrote a Haskell program that preforms a binary search on a list. At least that's what I thought it does. When I compiled the program with ghc v7.6.3 and ran the program I got the following output: progname: <<loop>> What on earth does this output mean? Does it mean I had an infinite loop that ghc optimized away? How am I supposed to debug this? 回答1: As several of the comments have said, this is the Haskell RTS detecting an infinite loop at run-time. It cannot always detect such loops, but

Using msysGit from MinGW and vice versa

≯℡__Kan透↙ 提交于 2019-12-17 15:56:42
问题 I am using git as my revision control system. To do so, I installed msysGit to checkout my repositories on MSW. Now I want to compile my programs with MinGW and found this "problem" for me: When I install MinGW and MSYS via mingw-get I can compile my program, no problem. But I can not access git. When I use the Git Bash, I can work with git, but can not compile. Is there any possibility to: install MinGW "into" Git Bash (because it already contains msys, didn't it?) OR to set "links" between

parameter name omitted, C++ vs C

眉间皱痕 提交于 2019-12-17 15:47:11
问题 In C++, I tend to omit the parameter's name under some circumstances. But in C, I got an error when I omitted the parameter's name. Here is the code: void foo(int); //forward-decl, it's OK to omit the parameter's name, in both C++ and C int main() { foo(0); return 0; } void foo(int) //definition in C, it cannot compile with gcc { printf("in foo\n"); } void foo(int) //definition in C++, it can compile with g++ { cout << "in foo" << endl; } Why is that? Can't I omit the parameter's name in C

How do I make Emacs recognize bash environment variables for compilation?

给你一囗甜甜゛ 提交于 2019-12-17 15:44:10
问题 I'm trying to compile u-boot via Emacs' compilation mode, and it looks like Emacs doesn't know how to find bash environment variables. Even though I set them, and can compile via Emacs shell emulation, compilation mode still tries to compile as if they aren't there. What do I need to do to make it more environment conscious? 回答1: You can try adding something like to your .emacs : (let ((path (shell-command-to-string ". ~/.bashrc; echo -n $PATH"))) (setenv "PATH" path) (setq exec-path (append