dev-cpp-users Mailing List for Dev-C++ (Page 51)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chris M. <lor...@gm...> - 2007-09-13 21:41:27
|
On 9/12/07, Per Westermark <pw...@ia...> wrote: > And exactly how do you think it would be good if _we_ solved the problem > for you? Don't you think that would void this test, and making your I'm not going to solve it for him, but I will help guide him to an answer. > education meaningless? I'm in high school. Don't ask that question. Most education is totally arbitrary and meaningless to begin with. To address the problem, you need to teach the computer. How would you break up those numbers, in your head? What do you think to yourself as you do it? > Is there a difference if we help you solve problems your teacher hands > out, and if we help you by taking your exams instead of you? > > This problem is very simple, but _you_ have to spend some time figuring > that out. In real life, there are not any other person that will step in > and solve your problems for you. How to solve it is quite simple. Simply observe yourself thinking while YOU solve it, before you write any code. That thinking process is the psuedocode that you will write in C/C++. I know it sounds crazy, observe yourself thinking, but it does work. |
From: Per W. <pw...@ia...> - 2007-09-13 06:24:36
|
And exactly how do you think it would be good if _we_ solved the problem for you? Don't you think that would void this test, and making your education meaningless? Is there a difference if we help you solve problems your teacher hands out, and if we help you by taking your exams instead of you? This problem is very simple, but _you_ have to spend some time figuring that out. In real life, there are not any other person that will step in and solve your problems for you. /pwm On Thu, 13 Sep 2007, parijat chauhan wrote: > my teacher give me a problem,but m not able 2 solve this one. > problem statement is as: > you have a positive number and you have to break it into its all > possible s= > um combinations. > no pair of combinations is to be repeated. > eg. > 5 can be broken as: > 1+1+1+1+1 > 2+1+1+1,2+2+1 > 3+1+1,3+2 > 4+1 > 6 can be broken as: > 1+1+1+1+1+1 > 2+1+1+1+1,2+2+1+1,2+2+2 > 3+1+1+1,3+2+1,3+3 > 4+1+1,4+2 > 5+1 > all these combinations is to be printed on console > thank you in advance > > -- > _______________________________________________ > Surf the Web in a faster, safer and easier way: > Download Opera 9 at http://www.opera.com > > Powered by Outblaze > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: parijat c. <par...@op...> - 2007-09-13 05:20:20
|
my teacher give me a problem,but m not able 2 solve this one. problem statement is as: you have a positive number and you have to break it into its all=20 possible s=3D um combinations. no pair of combinations is to be repeated. eg. 5 can be broken as: 1+1+1+1+1 2+1+1+1,2+2+1 3+1+1,3+2 4+1 6 can be broken as: 1+1+1+1+1+1 2+1+1+1+1,2+2+1+1,2+2+2 3+1+1+1,3+2+1,3+3 4+1+1,4+2 5+1 all these combinations is to be printed on console thank you in advance --=20 _______________________________________________ Surf the Web in a faster, safer and easier way: Download Opera 9 at http://www.opera.com Powered by Outblaze |
From: Adam J. <aj...@i-...> - 2007-09-10 13:20:33
|
>>You Wrote: >> I am unable to use the gotoxy() function. It shows the error:-Undefined function" Can somebody help me out with this problem. gotxy() is defined in conio.h. This (conio.h) is not part of the standard C. It is used for C style console io. This is a Borland creation and in not support by all C implementations\compilers. >> Also can u suggest where I can get an >> exhaustive list of all the predefined functions under different header files for dev c++. You can check out this reference book: C in a Nutshell (In a Nutshell (O'Reilly)) [ILLUSTRATED] (Paperback). Dev C++ using the mingw compiler. -Adam Jones i-softwareproducts.com From: dev...@li... [mailto:dev...@li...] On Behalf Of sudipta basu Sent: Saturday, September 08, 2007 6:13 PM To: dev...@li... Subject: [Dev-C++] Using gotoxy() function Hi, I am unable to use the gotoxy() function. It shows the error:-Undefined function" Can somebody help me out with this problem. Also can u suggest where I can get an exhaustive list of all the predefined functions under different header files for dev c++. Regards, Sudipta Structural Engineer Send instant messages to your online friends http://uk.messenger.yahoo.com |
From: sudipta b. <tup...@ya...> - 2007-09-08 22:12:52
|
Hi,=0A=0A I am unable to use the gotoxy() function. It shows the error:-= Undefined function" Can somebody help me out with this problem. Also can u= suggest where I can get an exhaustive list of all the predefined functions= under different header files for dev c++.=0A=0ARegards,=0ASudipta=0AStruct= ural Engineer=0A=0ASend instant messages to your online friends http://uk.m= essenger.yahoo.com |
From: Philip B. <phi...@pb...> - 2007-09-07 11:42:06
|
Hi everyone, I am having some very strange issues with the Dev-C++ IDE. Very often = when I load larger projects (3 or more files), or when I set focus back = to the project window after minimizing it with an equally large project = open, I get very odd application fatal errors, something about invalid = machine instructions etc. I can get many of these in a row until the = program finally shuts down. This happens both when I load the project, = and when the window receives focus. Regards Philip Bennefall |
From: <aj...@i-...> - 2007-09-06 13:56:25
|
Jonathan Winterflood wrote: > The compiler seems to have found timeGetTime in the header file, so > compilation works > > after that, though, the Linker cannot find the code of that function. > > You need to tell Dev-Cpp to link againt the library you are using > (mmsystem I imagine) > > Jonathan Jonathan you are correct he needs to include the library for this to work. The linker can't find the file that is why he is getting the error. He needs to add libwinmm.a to the linker. -Adam Jones i-softwareproducts.com |
From: Jonathan W. <jon...@gm...> - 2007-09-06 09:04:46
|
The compiler seems to have found timeGetTime in the header file, so compilation works after that, though, the Linker cannot find the code of that function. You need to tell Dev-Cpp to link againt the library you are using (mmsystem I imagine) Jonathan On 9/6/07, kve...@bk... <kve...@bk...> wrote: > > Hello, Dev-cpp-users. > > > #include <cstdlib> > #include <iostream> > > #include <windows.h> > #include <mmsystem.h> > > > using namespace std; > > int main(int argc, char *argv[]) > { > DWORD mytime; > > mytime = timeGetTime(); > > system("PAUSE"); > return EXIT_SUCCESS; > } > > I have a problem: > > [Linker error] undefined reference to `timeGetTime@0' > ld returned 1 exit status > D:\Dev-Cpp\my projects\37\Makefile.win [Build Error] [progr.exe] Error 1 > > what's wrong in my code? > > -- > best regards, mailto:kve...@bk... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > -- <Morpheus> linux, c'est une question de VI ou de MORE |
From: <kve...@bk...> - 2007-09-06 08:59:14
|
Hello, Dev-cpp-users. #include <cstdlib> #include <iostream> #include <windows.h> #include <mmsystem.h> using namespace std; int main(int argc, char *argv[]) { =09DWORD mytime; =09 =09mytime =3D timeGetTime(); =09 system("PAUSE"); return EXIT_SUCCESS; } I have a problem: [Linker error] undefined reference to `timeGetTime@0'=20 ld returned 1 exit status=20 D:\Dev-Cpp\my projects\37\Makefile.win [Build Error] [progr.exe] Error 1= =20 what's wrong in my code? --=20 best regards, mailto:kve...@bk... |
From: Reid T. <rei...@at...> - 2007-09-06 03:29:21
|
MOHAMMED SEIDU wrote: > Please someone help me with some open source library for reporting in > C++ application. I would be very glad if it is pdf but would accept any > other. > > ------------------------------------------------------------------------ > Pinpoint customers > <http://us.rd.yahoo.com/evt=48250/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v9.php?o=US2226&cmp=Yahoo&ctv=AprNI&s=Y&s2=EM&b=50>who > are looking for what you sell. > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users google libharu |
From: Chris M. <lor...@gm...> - 2007-09-05 23:40:54
|
search sourceforge On 9/5/07, MOHAMMED SEIDU <chi...@ya...> wrote: > Please someone help me with some open source library for reporting in C++ > application. I would be very glad if it is pdf but would accept any other. > > ________________________________ > Pinpoint customers who are looking for what you sell. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: > http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > |
From: MOHAMMED S. <chi...@ya...> - 2007-09-05 13:58:27
|
Please someone help me with some open source library for reporting in C++ application. I would be very glad if it is pdf but would accept any other. --------------------------------- Pinpoint customers who are looking for what you sell. |
From: Smitha V. B. <smi...@so...> - 2007-09-04 13:09:25
|
=20 =20 Hi ... Does any one knows abt anything abt MC68k emulator. Is there any free software is available using MC68k emulator.. Regds smitha |
From: Per W. <pw...@ia...> - 2007-09-03 17:31:54
|
You can't run any programs on Dev-C++. It is not an operating system. If you have problems porting a Unix program to run on Windows or under Cygwin, I would suggest that you return with a more specific post about your problem. /pwm On Mon, 3 Sep 2007, Feras wrote: > Dear All, > > I have a c++ code works under UNIX, I need to run this code on DEV_CPP, so far I have troubles to run this code on dev-cpp. I couldn't deal with it !! > > looking for your help, > > > Sincerely, > > Fo > |
From: Feras <fe...@ya...> - 2007-09-03 16:22:19
|
Dear All, I have a c++ code works under UNIX, I need to run this code on DEV_CPP, so far I have troubles to run this code on dev-cpp. I couldn't deal with it !! looking for your help, Sincerely, Fo |
From: <MFr...@to...> - 2007-09-01 22:01:30
|
I will be out of the office starting 08/31/2007 and will not return until 09/17/2007. I will be reviewing all messages when I return and will respond as promptly as possible at that time. If you need help prior to my return, please contact Lynn Chaffin or Andrew Lawrence. Thank You. ****************************** Matt Freeman Tomax Corporation Phone - 801.924.6300 ext. 6353 mfr...@to... http://www.tomax.com/ http://www.retail.net ****************************** |
From: Edward H. <hyl...@gm...> - 2007-09-01 16:00:56
|
hi,everyone. today, i wrote a program to test the function template. When i complided the program, it gave the errrors: spec.cpp:19: template-id `bytes<wchar_t*>' in declaration of primary template. After searching the network, i have no idea about this error. my g++ version is 3.22 the source code is here: //: spec.cpp #include<iostream> #include<string.h> #include<string> using namespace std; template<class T> size_t bytes(T& t){ cout << "(using primary template)\n"; return sizeof t; } size_t bytes(char*& s){ cout << "using char* overload)\n"; return strlen(s) + 1; } size_t bytes<wchar_t *>(wchar_t*& w){ cout << "(using wchar_t* specialization)\n"; return 2*(wcslen(w)+1); } } template<> size_t bytes<>(string& s){ cout << "(using string explicit specialization)\n"; return sizeof s; } template<> size_t bytes<float>(float& x){ cout << "(using float specialization)\n"; return sizeof x; } int main(){ int i; cout << "bytes in i: " << bytes(i) << endl; char *s = "hello"; cout << "bytes in s: " << bytes(s) << endl; wchar_t *w = L"goodbye"; cout << "bytes in w: " << bytes(w) << endl; string t; cout << "bytes in w: " << bytes(w) << endl; string t; cout << "bytes in t: " << bytes(t) << endl; float x; cout << "bytes in x: " << bytes(x) << endl; double y; cout << "bytes in y: " << bytes(y) << endl; return 0; } ~ thanks for your help! |
From: Per W. <pw...@ia...> - 2007-08-29 12:43:50
|
There is no specific protocol. Ina command-line application, you can open the specific text device and send characters and command codes. In a Win32 graphical application you make use of a GDI to print. Look into Win32 or MFC documentation. /pwm On Wed, 29 Aug 2007, Frank Ryan wrote: > What is the protocol used with C++ to direct output to a printer rather than > to MSDos window or a file? > > |
From: Frank R. <fr...@fr...> - 2007-08-29 12:01:07
|
What is the protocol used with C++ to direct output to a printer rather than to MSDos window or a file? |
From: Adam J. <aj...@i-...> - 2007-08-27 02:21:05
|
>> You wrote: >>Hi, >>how can i read binary data from file and transform it into integer? >>I need to read first two bytes from a file encoded in big-endian and >>transform it into an integer. >>I'm running linux on a Intel at the moment but the file is created by a sun. >>I can i do that? >>Thanks, This is tricky. You really need to know what you are doing here. I am assuming that you have a reason or know that the binary in the file represents integers. Converting binary to integers may not be the correct thing, but if you know that the binary represenst integers, you will need to read the file in a byte at a time. Assemble the bytes in the correct order and then do the simple calculation of switching the assembled bytes into an integer assuming the bytes are in big-endian. This is pretty straight forward assuming you know the binary file specification. -Adam Jones i-softwareproducts.com |
From: Per W. <pw...@ia...> - 2007-08-26 08:54:44
|
Dod you notice anything strange with the errors you got? The template functions that contains the code in the mset.h file does not generate any warnings. If you spend some time thingking about it, you might realize why. Hint: If you make use of inline functions, should the full implementation of the inline function be visible to the compiler at the place where you call it? A template function may be instantiated a number of times, using a lot of different template parameters. Who is responsible to generate the actual code for each of these used template data types or limits? /pwm On Sun, 26 Aug 2007, Edward Hyl wrote: > hi, i'm edward. > i finish a program to implement the set with template. but when i > compling the program, there are some wrong: > > > [edward@localhost chapter8]$ make -f tset.mk > g++ -c -o tset.o tset.cpp > g++ -o tset tset.o mset.o > tset.o(.text+0x1e): In function `main': > : undefined reference to `Set<int>::Set[in-charge]()' > tset.o(.text+0x41): In function `main': > : undefined reference to `Set<int>::insert(int const&)' > tset.o(.text+0x64): In function `main': > : undefined reference to `Set<int>::insert(int const&)' > tset.o(.text+0x87): In function `main': > : undefined reference to `Set<int>::insert(int const&)' > tset.o(.text+0xd2): In function `main': > : undefined reference to `Set<int>::remove(int const&)' > tset.o(.text+0x12d): In function `main': > : undefined reference to `Set<int>::contains(int const&) const' > tset.o(.gnu.linkonce.t._ZlsIiERSoS0_RK3SetIT_E+0x10): In function > `std::basic_ostream<char, std::char_traits<char> >& operator<< > <int>(std::basic_ostream<char, std::char_traits<char> >&, Set<int> > const&)': > : undefined reference to `Set<int>::print(std::basic_ostream<char, > std::char_traits<char> >&) const' > collect2: ld returned 1 exit status > make: *** [tset] Error 1 > > > my complier is g++3.2 > > > > the source code are below > > > // tset.cpp > #include<iostream> > #include "mset.h" > > //using namespace std; > using std::cout; > using std::endl; > > int main(){ > Set<int> s; > > s.insert(77); > s.insert(33); > s.insert(500); > cout << s << endl; > > s.remove(77); > cout << s << endl; > cout <<"s "<<(s.contains(77)?"does":"does not")<<" contains 77" << endl; > > return 0; > } > > > > > // set.h: Set class template > #ifndef MSET_H > #define MSET_H > > #include <iostream> > //#include <algorithm> > #include <stddef.h> > > template<class T> > class Set{ > public: > Set(); > bool contains(const T&) const; > void insert(const T&); > void remove(const T&); > void print(std::ostream &)const; > > private: > enum{LIMIT = 64}; > T elems[LIMIT]; > size_t nelems; > }; > > template<class T> > std::ostream& operator<<(std::ostream& os, const Set<T>& s){ > s.print(os); > return os; > } > #endif // SET_H > > > > //: set.cpp: Implementation for Set class template > //#include "set.h" > #include <iostream> > #include <algorithm> > #include <stddef.h> > #include "mset.h" > using std::cout; > using std::endl; > using std::ostream; > template<class T> > Set<T>::Set(){ > nelems = 0; > } > > > template<class T> > bool Set<T>::contains(const T& x) const{ > const T* eof = elems + nelems; > return std::find(elems, eof, x) != eof; > } > > > template<class T> > void Set<T>::insert(const T& x){ > if (nelems < LIMIT && !contains(x)) > elems[nelems++] = x; > } > > template<class T> > void Set<T>::remove(const T& x){ > T* eof = elems + nelems; > if (std::remove(elems, eof, x) != eof) > --nelems; > } > > template<class T> > void Set<T>::print(std::ostream& os) const > { > os << '{'; > for (int i = 0; i < nelems; ++i){ > if (i > 0) > os << ','; > os << elems[i]; > } > > os << '}'; > } > > thanks for you all! > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Edward H. <hyl...@gm...> - 2007-08-26 08:22:34
|
hi, i'm edward. i finish a program to implement the set with template. but when i compling the program, there are some wrong: [edward@localhost chapter8]$ make -f tset.mk g++ -c -o tset.o tset.cpp g++ -o tset tset.o mset.o tset.o(.text+0x1e): In function `main': : undefined reference to `Set<int>::Set[in-charge]()' tset.o(.text+0x41): In function `main': : undefined reference to `Set<int>::insert(int const&)' tset.o(.text+0x64): In function `main': : undefined reference to `Set<int>::insert(int const&)' tset.o(.text+0x87): In function `main': : undefined reference to `Set<int>::insert(int const&)' tset.o(.text+0xd2): In function `main': : undefined reference to `Set<int>::remove(int const&)' tset.o(.text+0x12d): In function `main': : undefined reference to `Set<int>::contains(int const&) const' tset.o(.gnu.linkonce.t._ZlsIiERSoS0_RK3SetIT_E+0x10): In function `std::basic_ostream<char, std::char_traits<char> >& operator<< <int>(std::basic_ostream<char, std::char_traits<char> >&, Set<int> const&)': : undefined reference to `Set<int>::print(std::basic_ostream<char, std::char_traits<char> >&) const' collect2: ld returned 1 exit status make: *** [tset] Error 1 my complier is g++3.2 the source code are below // tset.cpp #include<iostream> #include "mset.h" //using namespace std; using std::cout; using std::endl; int main(){ Set<int> s; s.insert(77); s.insert(33); s.insert(500); cout << s << endl; s.remove(77); cout << s << endl; cout <<"s "<<(s.contains(77)?"does":"does not")<<" contains 77" << endl; return 0; } // set.h: Set class template #ifndef MSET_H #define MSET_H #include <iostream> //#include <algorithm> #include <stddef.h> template<class T> class Set{ public: Set(); bool contains(const T&) const; void insert(const T&); void remove(const T&); void print(std::ostream &)const; private: enum{LIMIT = 64}; T elems[LIMIT]; size_t nelems; }; template<class T> std::ostream& operator<<(std::ostream& os, const Set<T>& s){ s.print(os); return os; } #endif // SET_H //: set.cpp: Implementation for Set class template //#include "set.h" #include <iostream> #include <algorithm> #include <stddef.h> #include "mset.h" using std::cout; using std::endl; using std::ostream; template<class T> Set<T>::Set(){ nelems = 0; } template<class T> bool Set<T>::contains(const T& x) const{ const T* eof = elems + nelems; return std::find(elems, eof, x) != eof; } template<class T> void Set<T>::insert(const T& x){ if (nelems < LIMIT && !contains(x)) elems[nelems++] = x; } template<class T> void Set<T>::remove(const T& x){ T* eof = elems + nelems; if (std::remove(elems, eof, x) != eof) --nelems; } template<class T> void Set<T>::print(std::ostream& os) const { os << '{'; for (int i = 0; i < nelems; ++i){ if (i > 0) os << ','; os << elems[i]; } os << '}'; } thanks for you all! |
From: Per W. <pw...@ia...> - 2007-08-25 20:17:38
|
Sorry, but your code doesn't seem to be readable. Maybe you should repost, and make sure that you have semicolons where there should be semicolons, and that there are no strange braces in the middle of the text. Look at the declaration of str in the private section of MyClass. Look at the strange declaration of temp in main. Look at the strange right brace at end of the assign to tmp. Also, read up on what auto_ptr is. Your MyClass constructor declares a local str variable. Didn't you plan on initializing the str in the private section? auto_ptr doesn't protect any pointers if you don't make sure that you always use it. Please visit http://en.wikipedia.org/wiki/Auto_ptr and spend some time, making sure that you understand what it is, and how to use it. Or check out the Boost library instead. /pwm On Sat, 25 Aug 2007, Jamiil Abduqadir wrote: > I would like to pass a variable pointer that has been instantiated using 'auto_ptr' to a class method, however, the compiler complains saying that it does not recognize the method call; gives me a number of options, basically the list of overloaded methods. So my question is, what is the proper way to pass 'auto_ptr('s)' to a method? > class MyClass{ > private: std::string str* > public: > MyClass(){ std::auto_ptr<std::string> str(new std::string("unknow"));} > MyMethod(const std::string& s){ str = s;} // <== Error?? > .......... > } > > main(){ > std::string temp* > std::auto_ptr<std::string> tmp(new std::string("hey!"));} > MyClass mc(); > mc.MyMethod(temp); // <<-- Error?? > ... > } |
From: Jamiil A. <jal...@gm...> - 2007-08-25 13:01:41
|
I would like to pass a variable pointer that has been instantiated using = 'auto_ptr' to a class method, however, the compiler complains saying = that it does not recognize the method call; gives me a number of = options, basically the list of overloaded methods. So my question is, = what is the proper way to pass 'auto_ptr('s)' to a method? class MyClass{ private: std::string str* public:=20 MyClass(){ std::auto_ptr<std::string> str(new = std::string("unknow"));} MyMethod(const std::string& s){ str =3D s;} // <=3D=3D Error?? .......... } main(){ std::string temp* std::auto_ptr<std::string> tmp(new std::string("hey!"));} MyClass mc(); mc.MyMethod(temp); // <<-- Error?? ... } |
From: Riccardo R. <rr...@pl...> - 2007-08-24 15:33:16
|
Hi, how can i read binary data from file and transform it into integer? I need to read first two bytes from a file encoded in big-endian and transform it into an integer. I'm running linux on a Intel at the moment but the file is created by a sun. I can i do that? Thanks, -- Riccardo Roasio |