GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Mar-2009, 12:28
akashj87 akashj87 is offline
New Member
 
Join Date: Feb 2009
Posts: 4
akashj87 is on a distinguished road

Pragma issue


I wrote the following program ;

CPP / C++ / C Code:
#include<stdio.h>
#include<conio.h>
void test_p();
#pragma startup test_p
int main()
{
  printf("i am in main");
  return 0;
}
void test_p()
{
printf("i am outside main\n");
}

As expected i should receive the output as
I am outside main
I am in main

But i am receiving linker error in turbo c 4.5 and output ("i am in main") in Devcpp

can you please tell me what went wrong ?

Please be descriptive, i am novice in programming
Last edited by admin : 03-Mar-2009 at 12:37. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #2  
Old 03-Mar-2009, 16:57
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,218
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Pragma issue


Quote:
Originally Posted by akashj87
I wrote the following program ;

CPP / C++ / C Code:
#pragma startup test_p


can you please tell me what went wrong ?
You are learning non-standard implementation-dependent features of a very old compiler.

Compilers are not required to recognize pragmas like this, so what's your point?

If you don't have a book and can't get one, why not try to find a tutorial that covers standard language features.

For example, you might start somewhere like this site: http://www.cplusplus.com/doc/tutorial/

If modern tutorials cover features that old compilers like yours don't implement, you might want to try to upgrade.

A search for threads on gidforums containing "download free compilers" gave the following link: http://www.gidforums.com/t-14630.html

If you are particularly attached to Borland, I would add http://www.turboexplorer.com/downloads to that helpful list for a (free) download of Borland's latest and greatest.



Regards,

Dave
  #3  
Old 03-Mar-2009, 17:12
akashj87 akashj87 is offline
New Member
 
Join Date: Feb 2009
Posts: 4
akashj87 is on a distinguished road

Re: Pragma issue


Thanks mate for your help...I was following Let us C by yashavant kanetkar..i heard good reviews about it. But as you told me that its old styled, so i am following what you told me.
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Usage of Pragma in C kashyap C Programming Language 5 23-Aug-2007 10:34
pointer/memory issue acosgaya C++ Forum 1 09-Feb-2007 12:50
how to issue dos command from c program jaininaveen C Programming Language 2 03-Mar-2006 11:02
Odd Variable Issue nniehoff MySQL / PHP Forum 2 16-Mar-2004 08:12
Meta Refresh Issue Brettjb Apache Web Server Forum 4 16-Dec-2003 04:10

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:55.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.