Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 18 Jun 2013, 01:23
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
preprocessor directive #if
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
mahaju


Joined: 11 Oct 2010
Posts: 455
Location: between the keyboard and the chair

PostPosted: 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
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3845

PostPosted: 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
View user's profile Send private message 
mahaju


Joined: 11 Oct 2010
Posts: 455
Location: between the keyboard and the chair

PostPosted: 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
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3845

PostPosted: 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
View user's profile Send private message 
mahaju


Joined: 11 Oct 2010
Posts: 455
Location: between the keyboard and the chair

PostPosted: Mon 26 Dec 2011, 01:10    Post subject:  

Oh Yeah
The main function
I knew I forgot something in this code Embarassed
Back to top
View user's profile Send private message 
mahaju


Joined: 11 Oct 2010
Posts: 455
Location: between the keyboard and the chair

PostPosted: 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
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3845

PostPosted: 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
View user's profile Send private message 
mahaju


Joined: 11 Oct 2010
Posts: 455
Location: between the keyboard and the chair

PostPosted: 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
View user's profile Send private message 
mahaju


Joined: 11 Oct 2010
Posts: 455
Location: between the keyboard and the chair

PostPosted: 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
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0581s ][ Queries: 11 (0.0128s) ][ GZIP on ]