| Author |
Message |
mahaju

Joined: 11 Oct 2010 Posts: 455 Location: between the keyboard and the chair
|
Posted: Sun 25 Dec 2011, 23:28 Post subject:
preprocessor directive #if |
|
I saw
| Code: | | #elif defined(TFM_X86_64) |
in a very long sample code
is it same as
| Code: | | #elif defined TFM_X86_64 |
??
Just checking
Thanks
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Mon 26 Dec 2011, 00:43 Post subject:
|
|
I am away right now, Try:
#define TFM
#define _X86_64
#ifdef TFM_X86_64
printf("merged defs?");
#endif
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
mahaju

Joined: 11 Oct 2010 Posts: 455 Location: between the keyboard and the chair
|
Posted: Mon 26 Dec 2011, 00:48 Post subject:
|
|
| Code: | #include<stdio.h>
#define TFM
#define _X86_64
#ifdef TFM_X86_64
printf("merged defs?");
#endif
|
it says
| Code: | C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw
32.a(main.o):main.c:(.text+0x104): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status |
This is in gcc in Windows 7
Why isn't it compiling? The code looks simple enough
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Mon 26 Dec 2011, 01:09 Post subject:
|
|
| mahaju wrote: | | Code: | #include<stdio.h>
#define TFM
#define _X86_64
#ifdef TFM_X86_64
printf("merged defs?");
#endif
|
it says
| Code: | C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw
32.a(main.o):main.c:(.text+0x104): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status |
This is in gcc in Windows 7
Why isn't it compiling? The code looks simple enough |
The ifdefs code needs to be in a main function ... I.figured if you were asking about ifdefs you would know that. Sorry, don't know the windows main functions.
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
mahaju

Joined: 11 Oct 2010 Posts: 455 Location: between the keyboard and the chair
|
Posted: Mon 26 Dec 2011, 01:10 Post subject:
|
|
Oh Yeah
The main function
I knew I forgot something in this code
|
|
Back to top
|
|
 |
mahaju

Joined: 11 Oct 2010 Posts: 455 Location: between the keyboard and the chair
|
Posted: Mon 26 Dec 2011, 01:15 Post subject:
|
|
| Code: | #include<stdio.h>
#define TFM
#define _X86_64
#ifdef TFM_X86_64
printf("merged defs?");
#endif
int main(){return 0;} |
Compiles fine
When I run it my AVG 2011 Free Edition antivirus says it's potential threat
What happened here??
And then same for
| Code: | #include<stdio.h>
int main(){
#define TFM
#define _X86_64
#ifdef TFM_X86_64
printf("merged defs?");
#endif
return 0;
}
|
Why is that?
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Mon 26 Dec 2011, 01:47 Post subject:
|
|
Did it print "merged defs" on the command line?
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
mahaju

Joined: 11 Oct 2010 Posts: 455 Location: between the keyboard and the chair
|
Posted: Mon 26 Dec 2011, 01:50 Post subject:
|
|
No
The antivirus is blocking it (1st code)
and the second one says "Access Denied" when it is run, then it's blocked by the antivirus
and it's not because my computer's infected either, I can compile all other code using gcc and none of them show up as Potential threats in the antivirus
I think it's got something to do with those predefined macro names
OK I changed the macro names into some random texts and it's still showing the same problems why is that?
|
|
Back to top
|
|
 |
mahaju

Joined: 11 Oct 2010 Posts: 455 Location: between the keyboard and the chair
|
Posted: Mon 26 Dec 2011, 02:11 Post subject:
|
|
Ok
I tried both the codes given above in Windows XP as well as puppy Linux 5.2.8 in VMWare player. They don't have antivirus installed so compiled executable is not blocked, however, it doesn't apparently do anything
Why is it like this?
|
|
Back to top
|
|
 |
|