Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 13, 2006 Is it possible to "preprocess only"? | ||||
---|---|---|---|---|
| ||||
Hello all, As far as I understand, standard C preprocessor works with text files and knows nothing about C but that's not right with DMC which refuses to preprocess ("-e" option) plain text files. I mean, is it right that there's no way to use DMC to preprocess non-c (or invalid c) files? Am I missing something? I get lexical errors with DMC where I get correctly preprocessed text files with "cl /P" or "gcc -E". Thanks, Paul. |
November 13, 2006 Re: Is it possible to "preprocess only"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Smirnov | Paul Smirnov wrote:
> As far as I understand, standard C preprocessor works with text files and
> knows nothing about C but that's not right with DMC which refuses to
> preprocess ("-e" option) plain text files.
>
> I mean, is it right that there's no way to use DMC to preprocess non-c (or
> invalid c) files? Am I missing something? I get lexical errors with DMC where
> I get correctly preprocessed text files with "cl /P" or "gcc -E".
A standard compliant preprocessor will not work with text files that are invalid C code. The preprocessor is defined to work by tokenizing the source text into preprocessor tokens; if there are non-C tokens in the source text, it will (correctly) fail.
|
November 20, 2006 Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | any one wants help in programming ( c++ ), then i m present at here e-mail me at: kirankhan005@hotmail.com, for any Question in C++ |
November 23, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Me & My | ok, dusting off many years of rust in my C programming, trying dmc, and what seems to be perfectly valid cpp code (hello world) generates three errors, mostly abut expecting ; or whatever after } or { or return statement. I assume this is a setup issue, any thoughts? |
November 23, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to ralph | ralph wrote:
> ok, dusting off many years of rust in my C programming, trying dmc, and what seems
> to be perfectly valid cpp code (hello world) generates three errors, mostly abut
> expecting ; or whatever after } or { or return statement.
>
> I assume this is a setup issue, any thoughts?
Try the -cpp switch.
|
November 23, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | code: #include <iostream.h> int main(); { cout <<"Hello World!\n"; return 0; } ------------- error: { ^ hello.cpp(5) : Error: '=', ';' or ',' expected return 0; ^ hello.cpp(7) : Error: '=', ';' or ',' expected } ^ hello.cpp(8) : Error: identifier or '( declarator )' expected --- errorlevel 1 |
November 23, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to ralph | and that's the same error with the -cpp switch. |
November 23, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to ralph | ralph wrote:
> #include <iostream.h>
>
>
> int main();
> {
> cout <<"Hello World!\n";
> return 0;
> }
>
Remove the ; after main().
|
November 24, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | that was it!!! I copied the wrong example. |
November 24, 2006 Re: Any one Needs Help in C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Me & My | this should work, right? code: #include <iostream.h> int main() { int x = 5; int y = 7; cout "\n"; cout << x + y << " " << x * y; cout "\n"; return 0; } error: cout "\n"; ^ ch1_1.cpp(6) : Error: ';' expected following declaration of struct member cout "\n"; ^ ch1_1.cpp(8) : Error: ';' expected following declaration of struct member --- errorlevel 1 |
Copyright © 1999-2021 by the D Language Foundation