- Linker errors involving template - 3 Updates
- convert int to hex - 10 Updates
- C++ for industrial automation - 5 Updates
- "Experimenting with a Proposed Standard Drawing Library for the C++ language" - 3 Updates
- [OT] fortran lib which provide python like data type - 1 Update
- Journals on C++ - 2 Updates
- "Experimenting with a Proposed Standard Drawing Library for the C++ language" - 1 Update
| DSF <notavalid@address.here>: Jan 31 02:34PM -0500 Hello! I know I'm not giving much information here, but posting all of the code is impractical. I am hoping someone knows the general conditions that might make the following happen. I have a class called "CopyDirectory". Within it is a template container "FAList" that holds a list of the class "HashIndex". CopyDirectory.h: class HashIndex {...}; class CopyDirectory { yadda, yadda, yadda, FAList<HashIndex> hindex; }; FAList has 30+ functions. CopyDirectory uses about seven of them. When compiling the entire project, I get the following linker errors: Error: Error: Unresolved external 'FAList<HashIndex>::Find(const HashIndex&) const' referenced from module copydirectory.cpp Error: Error: Unresolved external 'FAList<HashIndex>::Add(const HashIndex&)' referenced from module copydirectory.cpp Error: Error: Unresolved external 'FAList<HashIndex>::XlateCI()' referenced from module copydirectory.cpp Error: Error: Unresolved external 'FAList<HashIndex>::GetItem(int)' referenced from module copydirectory.cpp Note that GetItem is not called by CopyDirectory and XlateCI is a private function of the template. As noted, CopyDirectory uses more of the template's functions than Add and Find. The map file shows the other template functions used by HashIndex but, as expected, does not show Add or Find. This project used to compile with no errors. The only change I made is removing "virtual" from two of the template functions (the dtor and Sort) when I read that virtuals in a template are a "no-no." (Putting them back to virtual made no difference.) I know this is not much to go on, but I'm hoping it's the result of a commonly known error or that someone can offer tests to find out what is wrong. Thanks, DSF "'Later' is the beginning of what's not to be." D.S. Fiscus |
| Geoff <geoff@invalid.invalid>: Jan 31 12:07PM -0800 On Sat, 31 Jan 2015 14:34:18 -0500, DSF <notavalid@address.here> wrote: >is removing "virtual" from two of the template functions (the dtor and >Sort) when I read that virtuals in a template are a "no-no." (Putting >them back to virtual made no difference.) If undoing the changes makes no difference it means you didn't "recompile the entire project", which means you didn't clean everything before the recompilation and re-link. |
| Ian Collins <ian-news@hotmail.com>: Feb 01 09:50AM +1300 DSF wrote: > errors: > Error: Error: Unresolved external 'FAList<HashIndex>::Find(const > HashIndex&) const' referenced from module copydirectory.cpp Are the member functions of FAList defined inline, or in a separate file? If the latter, the file will probably have to be included in each compilation unit that uses FAList. -- Ian Collins |
| Rosario193 <Rosario@invalid.invalid>: Jan 31 09:09AM +0100 On Fri, 30 Jan 2015 19:54:24 +0100, Rosario193 wrote: better 2 functions... nice execise exendible to biger numbers possible there are errors... #include <stdio.h> #include <string.h> #include <limits.h> #define u8 unsigned char #define u32 unsigned #define i32 int #define P printf #define F for #define R return // convert u32 "argnumber" to // u8 array of digits "rstr" in base "base" little endian form // result ok if return one number > 0 // that is the len of the array "rstr" that contain "argnumber" i32 u32ToA(u8* rstr, u32 rstrsize, u32 argnum, u32 base) {u32 i, j, k; if(rstr==0) R -1; if(rstrsize>0xFFFFFFF|| rstrsize<2) R -1; rstr[0]=0; if(base<=1 || base>256) R -1; if(argnum==0){rstr[1]=0; R 1;} F(i=0; argnum!=0 && i<rstrsize; ++i) {rstr[i]=argnum%base; argnum/=base;} if(i==rstrsize) R -1; rstr[i]=0; /* the last 0 is not in the number digits */ R i; } i32 NumStrToDisplayStr(u8* rstr, u32 len) {static u8 str[64]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; u32 tmp, i, j, a, b; if(rstr==0) R -1; if(len>0xFFFFFFF||len<1) R -1; F(i=0, j=len-1; i<j; ++i, --j) {a=rstr[i]; b=rstr[j]; // we are not arabs so swap if(a>35||b>35) R -1; rstr[i]=str[b]; rstr[j]=str[a]; } if(i==j) {a=rstr[i]; if(a>35) R -1; rstr[i]=str[a]; } R len; } int main(void) {u32 m=0x12f5e188, i, x, base; i32 r; u8 result[128]; // 0..126 127[0] if(CHAR_BIT!=8 || sizeof(u32)!=4) {P("this can not to run here\n"); R 0;} F(base=0; base<=257; ++base) {r=u32ToA(result, 128, m, base); P("base=%u r=%u ", base, r); if(r>0) {if(base<=36) {if(NumStrToDisplayStr(result, (u32) r)==-1) R 0;} F(i=0; i<(u32)r; ++i) {if(base<=36) P("%c", result[i]); else {x=result[i]; P("%u", x); } if(base>36 && i!=(u32)r-1) P("_"); } } if(base!=0 && base%3==0) P("\n"); else P("#"); if(base>=2 && base<=36 && strlen(result)!=(u32)r) P("Find Error base=%u", base); } P("\n"); R 0; } |
| Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 31 08:09AM On Fri, 2015-01-30, Christopher Pisz wrote: > On 1/30/2015 4:04 AM, Rosario193 wrote: >> On Thu, 29 Jan 2015 10:06:05 -0600, Christopher Pisz wrote: >>> On 1/29/2015 1:51 AM, Rosario193 wrote: ... >>>> unsigned i, aa; >>>> aa=a; >>>> for( i=sizeof(int)-1; ; --i ) ... > listing. employeePay = twoWeekSalary is immediately obvious. You are > writing C++ (supposedly) code for humans to read. You are not working in > matlab. Well, I think it's ok with short, meaningless names if the scope is small and the code is otherwise clear ... but I suspect intToHexChar(int) above would not be helped by better naming alone. /Jorgen PS I haven't followed this thread, so I don't understand what's wrong with a std::sprintf(), wrapped with a std::string. Or any of the other obvious solutions which don't require duplicating that logic manually. -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
| Rosario193 <Rosario@invalid.invalid>: Jan 31 09:13AM +0100 On Sat, 31 Jan 2015 09:09:09 +0100, Rosario193 >i32 NumStrToDisplayStr(u8* rstr, u32 len) >{static u8 str[64]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if someone use static array in a function... Is that function not multithread? is it possible something goes wrong if 2 cpu read in the same time the same position of mem? |
| Geoff <geoff@invalid.invalid>: Jan 31 06:51AM -0800 On Sat, 31 Jan 2015 09:09:09 +0100, Rosario193 >possible there are errors... Does the fact you are posting erroneous code, fixing it, fixing the fixes and refactoring the fixed fixes not tell you there is something wrong with your method and style? |
| Rosario193 <Rosario@invalid.invalid>: Jan 31 04:50PM +0100 On Sat, 31 Jan 2015 06:51:50 -0800, Geoff wrote: >Does the fact you are posting erroneous code, fixing it, fixing the >fixes and refactoring the fixed fixes not tell you there is something >wrong with your method and style? yes it is a little difficult write error free code... expecially in numeric algos... |
| Rosario193 <Rosario@invalid.invalid>: Jan 31 04:53PM +0100 On Sat, 31 Jan 2015 06:51:50 -0800, Geoff <geoff@invalid.invalid> wrote: >Does the fact you are posting erroneous code, fixing it, fixing the >fixes and refactoring the fixed fixes not tell you there is something >wrong with your method and style? yes why have to write routines in this f... group... |
| Rosario193 <Rosario@invalid.invalid>: Jan 31 04:56PM +0100 On Wed, 28 Jan 2015 11:30:11 -0800, Geoff wrote: >>No, i really need help,I'm new in C ++ and I can not easily handle its concepts. >You also seem to have trouble with the concept of how to reply to >other people on Usenet. DO NOT REPLY TO YOUR OWN POSTS. the comunication is 1 to many so post and its reaply can be from the same person |
| Rosario193 <Rosario@invalid.invalid>: Jan 31 05:46PM +0100 On Sat, 31 Jan 2015 16:53:43 +0100, Rosario193 >>fixes and refactoring the fixed fixes not tell you there is something >>wrong with your method and style? >yes why have to write routines in this f... group... yes why have I to write routines in this f... group??? |
| Geoff <geoff@invalid.invalid>: Jan 31 09:32AM -0800 On Sat, 31 Jan 2015 17:46:02 +0100, Rosario193 >>>wrong with your method and style? >>yes why have to write routines in this f... group... >yes why have I to write routines in this f... group??? Yes, indeed. |
| Geoff <geoff@invalid.invalid>: Jan 31 09:50AM -0800 On Sat, 31 Jan 2015 16:56:40 +0100, Rosario193 >the comunication is 1 to many so post and its reaply can be from the >same person When you are replying to a specific person, it is logical, proper and courteous to reply to that post, not to your own post from an earlier time. |
| Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo>: Jan 31 01:19AM -0500 > I'd love to see a C++ group playing with Beaglebone Blacks, doing blog-posts on these things... and a vibrant community... > Because: just being able to get a light to blink with some C-code is far away from organizing an industrial or embedded project. I'm sure that leveraging C++, one can really do some great things in this area. > PS: the whole internet-of-things theme is also interesting in this respect. I want to run C++ code in gadgets and not use crazy stuff like javascript (https://tessel.io/). I see. There is nothing much I am aware of but there is something. Take a look at https://www.youtube.com/watch?v=fj_d9NUiL-o and http://arduino.cc, in particular http://arduino.cc/en/Reference/Libraries for the C++ libraries they provide. This might get you in contact with the people who also thinks C++ might be useful at machine control/industrial automation/robotics. Two words of caution though: 1. It is not accidental that the most of machine control applications are written in languages you call "crazy" (you mentioned JavaScript but there are lots of others, in particular at some point in the past Forth was very popular, LISP was used a lot, too. IMHO the common feature of these languages is the virtual machine capable of compiling and executing code in target environment. The ability to create such an environment cheaply (a typical full-fledged Forth target-side environment was well under 10KB of code and LISP environments were not much fatter) was apparently a critical requirement. Obviously nowadays more more computational resources are available on the embedded side but functionally this requirement is still there. Especially robotics and AI applications can win tremendously from the code's being generated or sent to the environment, and then being compiled and optimized "on the fly". Unfortunately, C++ might be the least suitable language for even simply dynamic loading of compiled code to the working application, let alone on-target compilation. 2. From my experience, early introduction of framework is a very common design mistake. A good framework can IMHO only be developed by summarizing real experience from multiple applications. Essentially, only after writing many "essentially same" pieces of code *and putting them to production, after all fixes that often change lots of models* you will find reasonable abstractions to reuse. Still any new occasion might require lots of re-doing (in the abstractions). An attempt to use a freshly-baked framework for a seemingly pliant task is often a waste. Useful abstractions get crystallized gradually. In some way a framework can be naturally seen as a set of constraints and rules and hopefully we can agree that it is harmful to start constraining designs early before building enough use cases (in our case, applications) that prove that the rules/constraints would be indeed reasonable. It is like coming to a foreign country and starting writing laws for its inhabitants without living among them for a long time. Long story short, my advice would be to develop your 1st, 2nd and maybe 3rd *non-trivial* (this is important) application right on top of the API provided by your platform of choice, then study the resulting code for similarities. If the results are not crying for the framework, postpone the framework and get back to it after developing / studying few more non-trivial applications. -Pavel |
| Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 31 08:22AM On Fri, 2015-01-30, Scott Lurndal wrote: >>that appear at the same conferences. (Scott Meyers, Herb Sutter, ...) > I wonder if these guys, who write about C++, have actually written > real-world production applications in C++? Don't know about the others, but Stroustrup shows clear signs of having been in the trenches (see e.g. the last few chapters in TC++PL 3rd ed). When he had time for that, I don't know. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
| Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 31 08:39AM On Sat, 2015-01-31, Pavel wrote: ... > Two words of caution though: [...] > resulting code for similarities. If the results are not crying for the > framework, postpone the framework and get back to it after developing > / studying few more non-trivial applications. Quoting it to fix the formatting. I agree wholeheartedly, and you formulate it well. It took me a decade of programming to see it that way. Sadly, too many never learn, and start any major project by writing a framework or abstraction layers which then turn out to be a bad fit for whatever the application needs to do :-/ /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
| jononanon@googlemail.com: Jan 31 01:15AM -0800 > (http://www.vollmann.ch/de/presentations/index.html) > Also: > http://www.artima.com/shop/effective_cpp_in_an_embedded_environment Some additional interesting reading-sources are: http://arobenko.gitbooks.io/bare_metal_cpp/ Real-Time C++ (by Christopher Kormanyos) http://www.springer.com/computer/communication+networks/book/978-3-642-34687-3 This last book seems very interesting. It uses C++11 and the author, Kormanyos, has also contributed to Boost. |
| "Öö Tiib" <ootiib@hot.ee>: Jan 31 09:08AM -0800 On Saturday, 31 January 2015 10:40:05 UTC+2, Jorgen Grahn wrote: > many never learn, and start any major project by writing a framework > or abstraction layers which then turn out to be a bad fit for whatever > the application needs to do :-/ Framework is good selling argument. At least it is good argument for incompetent ears (and usually we sell to incompetent ears). It sounds easy to extend and to reuse and so it sounds like good investment. Therefore we should always mention making or extending frameworks in visionary discussions. However in real work we should ignore it, if later asked for then we can extract some "framework" out from existing product. |
| Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 30 11:39PM On 30/01/2015 19:00, Lynn McGuire wrote: > take hold with Sutter behind it. > http://isocpp.org/blog/2014/01/n3888 > Now C++ needs a standard user interface library. No C++ does not need a standard user interface library; other languages have tried and failed to achieve that. /Flibble |
| Christopher Pisz <nospam@notanaddress.com>: Jan 30 05:44PM -0600 On 1/30/2015 5:39 PM, Mr Flibble wrote: > No C++ does not need a standard user interface library; other languages > have tried and failed to achieve that. > /Flibble .NET failed with WPF? |
| "Öö Tiib" <ootiib@hot.ee>: Jan 31 07:14AM -0800 On Saturday, 31 January 2015 01:39:44 UTC+2, Mr Flibble wrote: > > Now C++ needs a standard user interface library. > No C++ does not need a standard user interface library; other languages > have tried and failed to achieve that. That is attitude that results with various third party commercial crap like that Flash (proprietary ECMAScript) or that Unity (also ECMAScript and Mono) to be successful. Everybody knows how C++ is more efficient and everybody knows how pad or phone becomes hot in your hands when such Flash or Unity is running there. |
| Christian Gollwitzer <auriocus@gmx.de>: Jan 31 09:27AM +0100 Am 30.01.15 um 19:23 schrieb Paul Rubin: > That is a safe and simple approach, but it works by copying data all > over the place instead of passing pointers, resulting in performance > loss. This "performance loss" is partly a myth. Consider the following code, assuming it is compiled using a recent (C++11) compiler ==================== #include <vector> std::vector<double> compute() { const size_t N=100000; std::vector<double> result(N); for (size_t i=0; i<N; i++) { result[i]=2*i; } return result; } int main() { auto s = compute(); // print it or whatever return 0; } ========================= At first, it may seem that this code copies the big vector twice: Once into a temporary return value, once into the automatic variable s. This is not the case, once for the move constructors in C++11 and second for return value optimization, some years already in the compilers. Instead, the vector is constructed directly into the place where the main functinos expects it to be. Christian |
| Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 30 11:42PM >> Minimum = 20ms, Maximum = 21ms, Average = 20ms >> Lynn > I can ping wnd.com and twitter.com. wnd.com Brian? Really? Worse than Fox News mate; even I know this and I don't live in America. It might help if you get over this "God" delusion. /Flibble |
| Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 31 07:53AM On Fri, 2015-01-30, Lynn McGuire wrote: > On 1/30/2015 10:29 AM, Scott Lurndal wrote: >> Victor Bazarov <v.bazarov@comcast.invalid> writes: ... > C:\dii>ping google.com > Pinging google.com [64.233.168.101] with 32 bytes of data: > Reply from 64.233.168.101: bytes=32 time=21ms TTL=42 Not to mention there's a whole bunch of ICMP messages apart from Echo Request (ping). Some of them are vital if you want IPv4 to work properly, so I don't think anyone blocks the whole ICMP protocol. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
| ram@zedat.fu-berlin.de (Stefan Ram): Jan 31 04:38AM >.NET failed with WPF? Java failed with AWT, so they replaced it by Swing. Now, Swing also has failed. It had to be replaced by JavaFX. IIRC, WPF replaces WinForms, so WinForms also had failed. It is possible, that WPF and JavaFX will be replaced by something else in 5 - 10 years from now, as the history given above shows that GUI libraries tend to fail in Java-like languages and have to be replaced. GUI libraries for Java-like languages - a history of failure. However, a GUI library is different from a »Drawing Library«. C++ does not even have means to access directories of the file system or sockets via its standard library, which might be deemed more important than a drawing library by some. Also, a standard GUI interface would be helpful, which would include means to draw. »Drawing« is just outputting, while a GUI library also would read input from a user. We can draw with ASCII-Art for now, or output something like SVG or png. |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment