compiler-construction

How does a compiler (C/C++) identify a comment? [closed]

白昼怎懂夜的黑 提交于 2020-01-25 22:18:08
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . If my program has a string s1= "like/*this" , s2="like /*this is a comment */this" and s3 = "like // this is not a comment" In s1 and s3, "/ " and "//*" are part of the string. In s2, It is a comment for the users to be displayed on the output screen. What algorithm does the c/c++

iphone compiler inherited templated base classes with passed through type not being expanded in time (just look)

99封情书 提交于 2020-01-25 09:57:09
问题 Try this out: template <typename T> class Base { public: int someBaseMember; }; template <typename T> class Test: public Base<T> { public: void testFunc() { someBaseMember = 0; } }; In vc++ and the psp compiler (and any other compiler I've encountered) the above will work fine, with the iphone compiler (for device, gcc 4.2 I think, with the -fpermissive flag set) I get an error saying 'someBaseMember is not defined' on the 'someBaseMember = 0;' line The iphone compiler seems to be 'parsing'

Can't open Llvm in ocaml

别等时光非礼了梦想. 提交于 2020-01-25 04:55:08
问题 I'm trying to use llvm binding in ocaml, in my file test.ml, I have one line of code: open Llvm When I run the command ocamlbuild -use-ocamlfind test.byte -package llvm I get this result: + ocamlfind ocamldep -package llvm -modules test.ml > test.ml.depends ocamlfind: Package `llvm' not found Command exited with code 2. Compilation unsuccessful after building 1 target (0 cached) in 00:00:00. What did I do wrong in this? Thanks. BTW, the _tag file contains: "src": traverse <src/{lexer,parser}

How to prompt Matlab to use VS10 64 bit compiler

£可爱£侵袭症+ 提交于 2020-01-24 20:43:25
问题 I am trying to compile and run a 64bit application in MATLAB using the Visual Studio 2010 Professional compiler. I know both the program and the compiler work properly because when I start matlab from the Visual Studio x64 command prompt I am able to run the program without an issue. I have run mex -setup and selected the 2010 compiler as follows: mex -setup Please choose your compiler for building external interface (MEX) files: Would you like mex to locate installed compilers [y]/n? y

C# and Metadata File Errors

眉间皱痕 提交于 2020-01-24 15:55:29
问题 I've created my own little c# compiler using the tutorial on MSDN, and it's not working properly. I get a few errors, then I fix them, then I get new, different errors, then I fix them, etc etc. The latest error is really confusing me. --------------------------- --------------------------- Line number: 0, Error number: CS0006, 'Metadata file 'System.Linq.dll' could not be found; --------------------------- OK --------------------------- I do not know what this means. Can somebody please

Compile C program in Linux with different glibc library

折月煮酒 提交于 2020-01-24 11:26:44
问题 I have a firewall appliance base on linux that have glibc-2.3.4, and have not gcc to compile a program for that. when I compile a program by another linux machine, error message says: require glibc.x.x.x How can I compile a c program in another linux machine for that version of glibc? 回答1: Generally you have to use the proper building environment which contains all target libraries with the needed or compatible versions. The difference between libc variants is not only in linked library name

multipass a source code to cpp

◇◆丶佛笑我妖孽 提交于 2020-01-24 00:23:11
问题 basically, i'm trying to pass source code twice to gcc's cpp, then directly to gcc's c compiler. as to why, i believe there are just things that can never be made inline within a macro. here's an example: /* say i want to make an inline definition that can be inserted to any other macros */ #include <stdio.h> #define DEF_X #define X 22 int main(void) { DEF_X printf("%u", X); return 1; } then simply compile: gcc $MY_DIR/test_multi_pass.c -o $MY_DIR/test.exe of course, this won't work as when

multipass a source code to cpp

南笙酒味 提交于 2020-01-24 00:22:59
问题 basically, i'm trying to pass source code twice to gcc's cpp, then directly to gcc's c compiler. as to why, i believe there are just things that can never be made inline within a macro. here's an example: /* say i want to make an inline definition that can be inserted to any other macros */ #include <stdio.h> #define DEF_X #define X 22 int main(void) { DEF_X printf("%u", X); return 1; } then simply compile: gcc $MY_DIR/test_multi_pass.c -o $MY_DIR/test.exe of course, this won't work as when

Loading numpy into IronPython

我怕爱的太早我们不能终老 提交于 2020-01-23 12:22:13
问题 I've recently installed Ironpython + tools and having trouble loading external modules (numpy). this is my test code: import numpy numpy.test() when writing my simple test, intellisense can find numpy, however when it's run from vs2010, I get: ImportException was unhandled by user code: No module named numpy IronPython Console output (shortened): numpy\__init__.py line 141 numpy\add_newdocs.py line 9 numpy\lib\__init__.py line 4 numpy\lib\type_check.py line 8 numpy\core\__init__.py line 5

Loading numpy into IronPython

南楼画角 提交于 2020-01-23 12:19:56
问题 I've recently installed Ironpython + tools and having trouble loading external modules (numpy). this is my test code: import numpy numpy.test() when writing my simple test, intellisense can find numpy, however when it's run from vs2010, I get: ImportException was unhandled by user code: No module named numpy IronPython Console output (shortened): numpy\__init__.py line 141 numpy\add_newdocs.py line 9 numpy\lib\__init__.py line 4 numpy\lib\type_check.py line 8 numpy\core\__init__.py line 5