[Dev-C++] RE: Export keyword problem
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <cuo...@iw...> - 2002-06-14 16:12:49
|
In java there is import. But not in C++. In your case you would have to include the followin: #include "FileYouWannaInclude.h" in Main File. You probaly already knew.......http://www.vstore.com/cgi-bin/pagegen/iwonstores/megatron/page.htmlGREAT SHOPPING PLACE!!!!!!!!!!!!!!--- On Fri 06/14, < dev...@li... > wrote:From: [mailto: dev...@li...]To: dev...@li...: Fri 06/14Subject: Dev-cpp-users digest, Vol 1 #819 - 12 msgsSend Dev-cpp-users mailing list submissions tod...@li... subscribe or unsubscribe via the World Wide Web, visithttps://lists.sourceforge.net/lists/listinfo/dev-cpp-usersor, via email, send a message with subject or body 'help' tod...@li... can reach the person managing the list atd...@li... replying, please edit your Subject line so it is more specificthan "Re: Contents of Dev-cpp-users digest..."Today's Topics:1. Export keyword problem (Marcos Carrard)2. Re: superscript for squares (Mac Reiter)3. Re: Export keyword problem (Mac Reiter)4. Re: superscript for squares (Jason Hardman)5. Re: Export keyword problem (Jason Hardman)6. howto construct messages in win32 (Zodiaq)7. Re: superscript for squares (Jason Hardman)8. Re: howto construct messages in win32 (Jason Hardman)9. (no subject) (Nancy Alvarez)10. RE: Export keyword problem (Ioannis Vranos)11. Re: (no subject) (Abhijit Shylanath)12. Linker errors (Greg Elliot)--__--__--Message: 1Date: Thu, 13 Jun 2002 16:46:35 -0300From: Marcos Carrard To: dev...@li...: [Dev-C++] Export keyword problemThis is a multi-part message in MIME format.--------------D34575D5AFBFDC082B7BCB97Content-Type: text/plain; charset=iso-8859-1Content-Transfer-Encoding: quoted-printableX-MIME-Autoconverted: from 8bit to quoted-printable by main.unijui.tche.br id g5DJf7G09596Hi!The book C++ Primer, 3rd edition, Lippmann and Lajoie, speaks on twomodels of compilation: separation and inclusion. The separation modeldefines a function in a separate file and it becomes available with thekeyword export. I tested this in the Dev and it did not work. Thecompilation result say that the export keyword is not valid and thelinker don=B4t find my function definition. What I can make? The exportkeyword is not available?Thanks,Marcos--------------D34575D5AFBFDC082B7BCB97Content-Type: text/x-vcard; charset=us-ascii;name="carrard.vcf"Content-Description: Card for Marcos CarrardContent-Disposition: attachment;filename="carrard.vcf"Content-Transfer-Encoding: quoted-printableX-MIME-Autoconverted: from 8bit to quoted-printable by main.unijui.tche.br id g5DJf7G09596begin:vcard=20n:Carrard;Marcostel;cell:55-9973-1733tel;fax:55-3332-9100tel;home:55-3333-6556tel;work:55-3332-7100 Ramal 289x-mozilla-html:FALSEurl:www.detec.unijui.tche.br/~carrardorg:Universidade Regional do Noroeste do RS - Uniju=ED;Departamento de Te=cnologiaversion:2.1email;internet:ca...@un...;quoted-printable:;;Rua S=3DE3o Francisco, 501=3D0D=3D0ACx. Postal 561==3D0D=3D0ABairro S=3DE3o Geraldo;Iju=ED;RS;98.700-000;Brasilfn:Marcos Carrardend:vcard--------------D34575D5AFBFDC082B7BCB97----__--__--Message: 2Date: Thu, 13 Jun 2002 15:49:42 -0500To: From: "Mac Reiter" Subject: Re: [Dev-C++] superscript for squares>I could nor figure out how to use superscript for squares (like for example>12 ) in DEV++ IDE . Can you please tell me is there a short cut for doing>it or other method.Unfortunately I am unsure what you are trying to do... "superscript" is atypesetting issue, and unrelated to programming. What is "example 12"? Iam going to assume that you meant:2"like, for example, 1 "If you are viewing this with proportional spaced fonts, I was attempting toplace a "1" with a raised superscripted "2" above it...In an attempt to be useful, I will make a wild assumption and run with it.If it isn't useful, I apologize. If you are trying to raise one number to another power ( "one raised to thesecond power", otherwise known as "one squared" ), the function you want ispow(). In this particular example, it would be "pow(1,2)".IMPORTANT : pow() is a general purpose, floating point routine, capable ofhandling things like "pow(-13.9153, 9513.24351)", and because of that it isextremely slow compared to other methods if you are doing simple powers.If you are truly doing squares, the fastest method is to multiply thenumber by itself... Rather than doing "xsquared = pow(x,2)", just do"xsquared = x*x" and it will run a lot faster. If you are trying to raiseto a higher, but still integral power, (for example, "pow(3511.31451532,17)") there are fast routines for doing that. I found them in introcomputer science books. They involve bit shifting and masking though,which may be more involved that you want to get. If speed isn't a majorissue, just use pow().Mac-_____________________________ /"\Mac Reiter \ / ASCII Ribbon CampaignNomadics, Inc. X Against HTML Mai...@no... / \ (To join the campaign, simply usethis in your signature.)--__--__--Message: 3Date: Thu, 13 Jun 2002 16:38:28 -0500To: dev...@li...: "Mac Reiter" Subject: Re: [Dev-C++] Export keyword problem>The book C++ Primer, 3rd edition, Lippmann and Lajoie, speaks on two>models of compilation: separation and inclusion. The separation model>defines a function in a separate file and it becomes available with the>keyword export. I tested this in the Dev and it did not work. TheI do not have this book available, but in a fair number of years of C andC++ programming, I have never heard of the "export" keyword, except for DLLcreation in Microsoft compilers. The closest I can think of is the"extern" keyword, but it is used to import things from other compilationunits, and it is _not_ needed to get access to functions.Could you give one or more quotes from your book, preferably with smallcode examples if possible?Mac-_____________________________ /"\Mac Reiter \ / ASCII Ribbon CampaignNomadics, Inc. X Against HTML Mai...@no... / \ (To join the campaign, simply usethis in your signature.)--__--__--Message: 4From: "Jason Hardman" To: "Dev-C++" ,"Dane Cannon" Subject: Re: [Dev-C++] superscript for squaresDate: Thu, 13 Jun 2002 23:15:53 +0100How about 2² = 4 etc.You will find that word processors do it by using a smaller size font raised up in space, howeverstandard character maps will normally have numbers 1 2 3 i.e. ¹ ² ³, and you can bring them upusing your keyboard by pressing the Alt key, holding it down, and typing on your number keypad (onthe right) a specific number try: Alt+0178.You may know this, but not everybody realises. You can find out these codes by using the Charactermap program that is included with windows and found under Accessories - System Tools. If you haven'tinstalled it then you can add it from the windows disk using the Add/Remove programs Windows setupfeature. You will need to change the font to the one you are using, which was Times New Roman in mycase.If you are working with a windows display then you can use the graphical capabilities of the WinAPIto change the font sizes and move the characters around, like a word processor does, but thatrequires hand coding the changes.Another way of displaying these numbers if the Alt key combination doesn't work is to find out thecharacter code that corresponds to that symbol, but I'll let you figure that out.Hope this helps, Jason.----- Original Message -----From: "Dane Cannon" To: Sent: Thursday, June 13, 2002 4:47 PMSubject: [Dev-C++] superscript for squaresHi,I could nor figure out how to use superscript for squares (like for example12 ) in DEV++ IDE . Can you please tell me is there a short cut for doingit or other method.Thank you very much,Anna Cannon_______________________________________________________________Don't miss the 2002 Sprint PCS Application Developer's ConferenceAugust 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink_______________________________________________Dev-cpp-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/dev-cpp-users--__--__--Message: 5From: "Jason Hardman" To: "Dev-C++" Subject: Re: [Dev-C++] Export keyword problemDate: Thu, 13 Jun 2002 23:24:55 +0100Here's a qoute from a reference I have:"The export keyword can precede a template declaration. It allows other files to use a templatedeclared in a different file by specifying only its declaration rather than duplicating its entiredefinition."If I remember correctly this feature is very new and not implemented in many compilers yet. It's todo with the fact that old style binaries/libraries didn't have the ability to represent a templatedfunction within themselves, they could only represent a template function that had been targetted toa specific type at compile time, i.e. int, float, MyClass, etc...Also of interest:"extern is a data type modifier that tells the compiler about a variable that is defined elsewherein a program. This is often used in conjunction with separately compiled files that share the sameglobal data. In essence, it notifies the compiler about the type of a variable without redefiningit.......""For C++ only, extern is also used to create a linkage specification......"Hope this helps,Jason.----- Original Message -----From: "Mac Reiter" To: Sent: Thursday, June 13, 2002 10:38 PMSubject: Re: [Dev-C++] Export keyword problem>The book C++ Primer, 3rd edition, Lippmann and Lajoie, speaks on two>models of compilation: separation and inclusion. The separation model>defines a function in a separate file and it becomes available with the>keyword export. I tested this in the Dev and it did not work. TheI do not have this book available, but in a fair number of years of C andC++ programming, I have never heard of the "export" keyword, except for DLLcreation in Microsoft compilers. The closest I can think of is the"extern" keyword, but it is used to import things from other compilationunits, and it is _not_ needed to get access to functions.Could you give one or more quotes from your book, preferably with smallcode examples if possible?Mac-_____________________________ /"\Mac Reiter \ / ASCII Ribbon CampaignNomadics, Inc. X Against HTML Mai...@no... / \ (To join the campaign, simply usethis in your signature.)_______________________________________________________________Don't miss the 2002 Sprint PCS Application Developer's ConferenceAugust 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink_______________________________________________Dev-cpp-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/dev-cpp-users--__--__--Message: 6Date: Fri, 14 Jun 2002 00:28:17 +0200From: Zodiaq Reply-To: Zodiaq Organization: EarthTo: dev...@li...: [Dev-C++] howto construct messages in win32Hello to all dev-cpp users,I know it is a little OT, but I need some help... does anybody havea good idea how to contruct properly messages in win32 environment...question is kinda strange, so let me specify my problem:I would like to build messages from chars, put inside some doubles(FLOATs) and then some other chars etc... well I know that sprintfworks fine, but I want to use some newer (C++ , Win32 or std)methodes... I tried ostrstream but behavour is veeeeery strange when I tryto write to it more than once - I get only numbers... then I triedstring and use it:string text = "alfa" + number + " $";but then, when sending it to controls I get a VERY strange behavour -sending it by text.c_str( ) in controls (edit boxes) I get text frommy program, but from very strange places - like from error messages...So finishing - does anybody know a good solution for my problem...btw I'm using Visual C++ .NET (few houres ago I used VC 6 and I gotthe same errors... and waiting for some fully functional Dev-C++ andnew mingw...) and WinXP if it helps in anything...For now the only way for me is to write my own methods... but thiswill take time, which I don't have much to spare...--regards, Zodiaq...--__--__--Message: 7From: "Jason Hardman" To: "Dev-C++" Subject: Re: [Dev-C++] superscript for squaresDate: Thu, 13 Jun 2002 23:30:19 +0100Also I forgot to mention that most people will recognise that when you write: 2^2 you actualy meantwo-squared, although in the C/C++ universe it can be missleading as the '^' actualy means bitwiseXOR.Jason.----- Original Message -----From: "Jason Hardman" To: "Dev-C++" ; "Dane Cannon" Sent: Thursday, June 13, 2002 11:15 PMSubject: Re: [Dev-C++] superscript for squaresHow about 2² = 4 etc.You will find that word processors do it by using a smaller size font raised up in space, howeverstandard character maps will normally have numbers 1 2 3 i.e. ¹ ² ³, and you can bring them upusing your keyboard by pressing the Alt key, holding it down, and typing on your number keypad (onthe right) a specific number try: Alt+0178.You may know this, but not everybody realises. You can find out these codes by using the Charactermap program that is included with windows and found under Accessories - System Tools. If you haven'tinstalled it then you can add it from the windows disk using the Add/Remove programs Windows setupfeature. You will need to change the font to the one you are using, which was Times New Roman in mycase.If you are working with a windows display then you can use the graphical capabilities of the WinAPIto change the font sizes and move the characters around, like a word processor does, but thatrequires hand coding the changes.Another way of displaying these numbers if the Alt key combination doesn't work is to find out thecharacter code that corresponds to that symbol, but I'll let you figure that out.Hope this helps, Jason.----- Original Message -----From: "Dane Cannon" To: Sent: Thursday, June 13, 2002 4:47 PMSubject: [Dev-C++] superscript for squaresHi,I could nor figure out how to use superscript for squares (like for example12 ) in DEV++ IDE . Can you please tell me is there a short cut for doingit or other method.Thank you very much,Anna Cannon_______________________________________________________________Don't miss the 2002 Sprint PCS Application Developer's ConferenceAugust 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink_______________________________________________Dev-cpp-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/dev-cpp-users_______________________________________________________________Don't miss the 2002 Sprint PCS Application Developer's ConferenceAugust 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink_______________________________________________Dev-cpp-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/dev-cpp-users--__--__--Message: 8From: "Jason Hardman" To: "Dev-C++" ,"Zodiaq" Subject: Re: [Dev-C++] howto construct messages in win32Date: Thu, 13 Jun 2002 23:48:16 +0100Please clarify, what output do you want? What is the strange output you got? What do you meanmessages, just text strings, or maybe popup message dialogues (MessageBoxEx)?Also the sprintf function is perfectly standard C++, and there is no problem in using it still. Ithink the reason your assignment didn't work was because you tried to add '+' a c-string to a float,which isn't a valid combination in C++ (although it is valid in Java).Try this:string text = "alfa";text += number;text += " $";or:string text = string("alfa") + number + string(" $");I'm not certain about the validity of the second one, but the idea is right. The string class hasoperator overloading for the + symbol to allow you to add non-string types to it, but the oldc-string, which is just an array of chars doesn't allow it.Jason.----- Original Message -----From: "Zodiaq" To: Sent: Thursday, June 13, 2002 11:28 PMSubject: [Dev-C++] howto construct messages in win32Hello to all dev-cpp users,I know it is a little OT, but I need some help... does anybody havea good idea how to contruct properly messages in win32 environment...question is kinda strange, so let me specify my problem:I would like to build messages from chars, put inside some doubles(FLOATs) and then some other chars etc... well I know that sprintfworks fine, but I want to use some newer (C++ , Win32 or std)methodes... I tried ostrstream but behavour is veeeeery strange when I tryto write to it more than once - I get only numbers... then I triedstring and use it:string text = "alfa" + number + " $";but then, when sending it to controls I get a VERY strange behavour -sending it by text.c_str( ) in controls (edit boxes) I get text frommy program, but from very strange places - like from error messages...So finishing - does anybody know a good solution for my problem...btw I'm using Visual C++ .NET (few houres ago I used VC 6 and I gotthe same errors... and waiting for some fully functional Dev-C++ andnew mingw...) and WinXP if it helps in anything...For now the only way for me is to write my own methods... but thiswill take time, which I don't have much to spare...--regards, Zodiaq..._______________________________________________________________Don't miss the 2002 Sprint PCS Application Developer's ConferenceAugust 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink_______________________________________________Dev-cpp-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/dev-cpp-users--__--__--Message: 9From: "Nancy Alvarez" To: dev...@li...: Fri, 14 Jun 2002 00:18:14 +0000Subject: [Dev-C++] (no subject)Hi,Somebody can say what to do for calculate sin, cossin, tangent. How are entries.? For example: I have a function x(tan x) If x=5 , Do I write 5(tan 5) in my routine?Thanks_________________________________________________________________Descargue GRATUITAMENTE MSN Explorer en http://explorer.yupimsn.com/intl.asp.--__--__--Message: 10From: "Ioannis Vranos" To: Subject: RE: [Dev-C++] Export keyword problemDate: Fri, 14 Jun 2002 05:06:15 +0300> -----Original Message-----> From: dev...@li...=20> [mailto:dev...@li...] On Behalf=20> Of Marcos Carrard> Sent: Thursday, June 13, 2002 10:47 PM> To: dev...@li...> Subject: [Dev-C++] Export keyword problem>=20>=20> Hi!>=20> The book C++ Primer, 3rd edition, Lippmann and Lajoie, speaks on two> models of compilation: separation and inclusion. The separation model> defines a function in a separate file and it becomes=20> available with the> keyword export. I tested this in the Dev and it did not work. The> compilation result say that the export keyword is not valid and the> linker don=B4t find my function definition. What I can make? The =export> keyword is not available?export is for template functions.For normal functions you provide the definition in a file, e.g.void something(void){// ...}and in the other files that you want to use that function you declare itbefore its use (typically at the beginning of the file):void something(void);or extern void something(void);which are both equivallent.Ioannis* Ioannis Vranos* Programming pages: http://www.noicys.cjb.net* Alternative URL: http://run.to/noicys--__--__--Message: 11From: "Abhijit Shylanath" To: "Nancy Alvarez" ,"Dev-C++ Mailing List" Subject: Re: [Dev-C++] (no subject)Date: Fri, 14 Jun 2002 13:20:25 +0530Organization: RetrogressionYou'll have to convert the mathematical expression into a C-styleexpression.For example:#include x = r * cos(theta);y = r * sin(theta);In your program you'll have to usex = 5;y = x * tan(x);Note that y should be a float or double if you want to use it practically.So,y = (float)x * tan(x);Check math.h for more functions.--------------------------http://mudeth.tripod.com----- Original Message -----From: "Nancy Alvarez" To: Sent: Friday, June 14, 2002 5:48 AMSubject: [Dev-C++] (no subject)>>> Hi,>> Somebody can say what to do for calculate sin, cossin, tangent. How are> entries.? For example: I have a function x(tan x) If x=5 , Do Iwrite> 5(tan 5) in my routine?>> Thanks>--__--__--Message: 12From: "Greg Elliot" To: dev...@li...: Fri, 14 Jun 2002 12:26:54 +0000Subject: [Dev-C++] Linker errorsHiyaIm trying to use this source code, but when i go to compile i get loads of linker errors, how do i go about correcting these. Im a novice so simple instructions would be useful. Thanks. Ive included the source code below. Thanks#include #include int main(int argc, char** argv) {WORD version = MAKEWORD(1,1);WSADATA wsaData;int nRet;//// Start up Winsock as before//WSAStartup(version, &wsaData);//// Store information about the server//LPHOSTENT lpHostEntry;lpHostEntry = gethostbyname("www.hal-pc.org"); // Specifying server by its nameif (lpHostEntry == NULL) {printf("Error at gethostbyname()");return 0;}//// Create the socket//SOCKET theSocket;theSocket = socket(AF_INET, // Go over TCP/IPSOCK_STREAM, // Socket typeIPPROTO_TCP); // Protocolif (theSocket == INVALID_SOCKET) {printf("Error at socket()");return 0;}//// Use SOCKADDR_IN to fill in address information//SOCKADDR_IN saServer;saServer.sin_family = AF_INET;saServer.sin_addr = *((LPIN_ADDR)*lpHostEntry->h_addr_list);// ^ Address of the server being inserted into the address fieldsaServer.sin_port = htons(80);//// Connect to the server//nRet = connect(theSocket,(LPSOCKADDR)&saServer, // Server addresssizeof(struct sockaddr)); // Length of address structureif (nRet == SOCKET_ERROR) {printf("Error at connect()");return 0;}// Successfully connected!closesocket(theSocket);//// Shutdown Winsock//WSACleanup();}_________________________________________________________________Chat with friends online, try MSN Messenger: http://messenger.msn.com--__--__--_______________________________________________Dev-cpp-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/dev-cpp-usersEnd of Dev-cpp-users Digest ------------------------------------------------ Can a Web portal forever change your life? Win up to $25 Million on iWon - click here! |