Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Jeryth

@Jeryth
About
Posts
44
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Include Help Needed
    J Jeryth

    Hmm, I didn't make this an MFC project per se, just started with an empty solution but I guess some MFC is still being put it automatically. That link was rather helpful, shows the same error message I'm getting so that should be the right track. I'm not using strcpy or strncpy anywhere. I use my own loops to copy element by element in CABLE. In fact the only string function I think I'm using is strlen. Here's the CABLE class in it's entirty. It's pretty simplistic, I'm pretty much just doing it for practice with plans to add on to it as I learn more.

    #include CABLE::CABLE()
    {
    cable = new char[1];
    cable[0] = '\0';
    length = 0;
    }

    //Private constructor, used only to create a temp CABLE of set size that is NULL filled.
    CABLE::CABLE( int newLength )
    {
    cable = new char[newLength+1];
    length = newLength;
    for( int i = 0; i <= length; ++i )
    {
    cable[i] = '\0';
    }
    }

    CABLE::CABLE( const char * const newCable )
    {
    length = strlen( newCable );
    cable = new char [length+1];
    for( int i = 0; i <= length; ++i )
    {
    cable[i] = newCable[i];
    }
    cable[length] = '\0';
    }

    CABLE::CABLE( const CABLE & rhs )
    {
    length = rhs.GetLength();
    cable = new char[length+1];
    for( int i = 0; i <= length; ++i )
    {
    cable[i] = rhs[i];
    }
    cable[length] = '\0';
    }

    CABLE::~CABLE()
    {
    delete cable;
    cable = NULL;
    length = 0;
    }

    CABLE & CABLE::operator=( const CABLE & rhs )
    {
    if ( this != &rhs )
    {
    delete [] cable;
    length = rhs.GetLength();
    cable = new char[length+1];
    for( int i = 0; i <= length; ++i )
    {
    cable[i] = rhs[i];
    }
    cable[length] = '\0';
    }

    return \*this;
    

    }

    char & CABLE::operator[]( int offset )
    {
    if ( offset > length )
    {
    return cable[length-1];
    }
    else
    {
    return cable[offset];
    }
    }

    char CABLE::operator[]( int offset ) const
    {
    if ( offset > length )
    {
    return cable[length-1];
    }
    else
    {
    return cable[offset];
    }
    }

    CABLE CABLE::operator+( const CABLE & rhs )
    {
    int totalLength = length + rhs.GetLength();
    CABLE temp( totalLength );
    for( int i = 0; i < length; ++i )
    {
    temp[i] = cable[i];
    }
    for( int j = 0; j < rhs.GetLength(); ++j, ++i )
    {
    temp[i] = rhs[j];
    }
    temp[totalLength] = '\0';

    return temp;
    

    }

    void CABLE::operator+=( const CABLE & rhs )
    {
    int totalLength = length + rhs.GetLength();
    CABLE temp( totalLength );
    for( int i = 0; i < length; ++i )
    {
    temp[i] = cable[i];
    }
    for( int j = 0;

    C / C++ / MFC help question c++ com

  • Include Help Needed
    J Jeryth

    No, no, I've been known to make basic mistakes. Nearly tore all my hair out after typing 50 pages of code and couldn't get it to compile. Then found a missing semicolon about 20 lines up from where the compiler had flagged the error. No, found out the problem. I had CABLE files in a different directory ( I wanted to keep them in a generic use folder ) and had added that directory to the project include folders, but had not added the files themselves to the project. Now compiling and linking is fine, but I've got yet ANOTHER problem. I run the program in the debugger and after I get through a few menus, I get this: DAMAGE: before Normal block ( #92 ) at ( 0x00323798 ) In stepping back through the debugger, it hilights the CABLE destructor. In particular, the line delete [] cable; The cable var is a char * array so I don't know why it wouldn't be able to delete it. Any ideas here? ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • Equality ( operator== ) Overload
    J Jeryth

    Wow, got it right on the first guess. Thanks for the confirmation. ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC question com regex tutorial

  • Include Help Needed
    J Jeryth

    Yeah, saw the destructor reference and that was the first thing I checked before I posted. If only it would have been so easy. I'm not explicitly calling for any CABLEs to be made in the TABLE constructor. I'm creating some other objects that have CABLEs in them, but I'm pretty sure none of them are getting destroyed. I've got one implicit cast where I grab a line from cout and pass that into a function that's looking for a CABLE, so the VS is just doing that on its own. Don't know where the problem might be coming from. ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • Equality ( operator== ) Overload
    J Jeryth

    I've never overloaded the equality operator and am having difficulty finding example code in MSDN for doing so. I'm guessing it looks a little something like this: bool CLASS_NAME::operator==( const CLASS_NAME & rhs ) const { //Perform tests on length, size //and any other info needed //return true if all match //false for all other cases } Is this correct or am I missing something? ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC question com regex tutorial

  • Include Help Needed
    J Jeryth

    Okay so I changed those and it cleared up some of the mess. But the old errors came back. In the errors below, CABLE is what I've been referring to as Class A and TABLE is Class F, the bottom tier one. error LNK2019: unresolved external symbol "public: __thiscall CABLE::~CABLE(void)" (??1CABLE@@QAE@XZ) referenced in function "public: __thiscall TABLE::TABLE(int)" (??0TABLE@@QAE@H@Z) error LNK2019: unresolved external symbol "public: __thiscall CABLE::~CABLE(void)" (??1CABLE@@QAE@XZ) referenced in function __unwindfunclet$??0CARD@@QAE@XZ$0 Looks like it doens't know where to go for CABLE function calls. Any ideas? ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • Include Help Needed
    J Jeryth

    You're right, I mis-labeled my problem. All classes compiled fine, they just wouldn't link. It was complaining about resolving an exxternal link error or somthing along those lines. ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • Include Help Needed
    J Jeryth

    Steen Krogsgaard wrote: Are you absolutely sure that your problems stems from multiple inclusions of the classA header? I'll say I'm 95% sure that's the cause. All the linking errors mentioned Class A name in the error field. But now I have a new problem. I took Dave Crow's advice and redid my #ifndef statements. Now I'm testing in the class header file if an appropriate preprocessor tag has been defined, if not then it defines it and it continues to have the class declared. If it already has, it skips it. After the initial #ifndef I use separate ones to test for any required includes for that class. For example, Class A looks like this: #ifndef CLASS_B_INC #define CLASS_B_INC #pragma once #ifndef CLASS_A_INC #include "CLASS_A.h" #endif //Rest of Class here #endif I think part of my problem was that I was possibly defining the pre-processor tags multiple times. This way, they only get defined in that class' header file. Note here that Class B won't try to define CLASS_A_INC ( that's left to Class A to do ) it will just include it and when that does Class A will define it on its own. Now something like that written above is in all .h files. The .cpp files only have #ifndef CLASS_A_INC #include "CLASS_A.h" #endif for their own classes, so above would be the Class A .cpp file. Now I'm getting errors that certain elements can't be found such as "cout : undeclared identifier" and "Class E : undeclared identifier" so some of my #include statements aren't being processed and I don't know why. ________________________________________________________________________ The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • Include Help Needed
    J Jeryth

    DavidCrow wrote: The correct quote is from Dijkstra: "The question of whether computers can think is like the question of whether submarines can swim." I know where it comes from, I just didn't care to type the whole thing. But you're the first to recognize it, at least the first to comment. Anyway, I didn't catch all that code you typed. Looked up the pragma pre-processor keyword and understand that coupled with the "once". That is I understand the point of it but not necessarily the implementation. Mind explaining it a bit? I take it _MSC_VER is built in, correct? As for the defining tags, does that whole line of AFX_blah_blah_blah have to be there or can it be my own tag? The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • can VC++ create a MAC version
    J Jeryth

    To answer the topic question, no I don't believe Visual Studio can compile for Mac execution. It may be a hidden feature but not one I'm aware of. Given MS dislike for Apple I don't imagine they'd make software that can support Apple hardware. For a little side note lesson, one which you may already know, the main reason program execution can't be directly taken from one machine to another ( Intel -> Apple, Apple -> Alpha, etc ) is because of the CPU architechture. The CPU internals just work differently which is why code needs to be ported rather than just copied over. If you're using ANSI standard C++ ( nothing unique to .NET, Windows environment, DirectX, etc ) all you need to do is copy the the source code and build it on a Mac with a C++ development suite. I'm not familiar with Mac development so I can't recommend a good Mac IDE. Being as .cpp and .h files are just strict ASCII text files they're universally recognizable so you should be able to just copy them straight across. If you are using Windows unique code, DirectX, or anything like that, you'll have to replace those sections with Mac compliant code. As far as I know there's no way around this. The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC c++ question announcement

  • Include Help Needed
    J Jeryth

    I've got a bit of trouble figuring out the proper way to include classes and headers. Now as I've always been taught, you should type out a class declaration in a header file and leave the definition for the cpp file. Then when that's completed, you should only #include header files. That's the "etiquette" I've been taught anyway so that's what I'm employing here. Though I'm beginning to think some of my professors who cling to that are rather daft. Now on to the problem. I have Class A that is required for Class B. Now Classes C and D both require Class B. Class E requires Classes A and C. Finally Class F requires D and E. Lost you yet? Maybe this will help:

    Class A
    /       \\
    

    Class B \
    | \ \
    Cls D Cls C |
    | \ |
    \ Class E
    \ /
    Class F

    Now each individual cpp compiles lovely, the problem comes when linking. The errors always point to Class A so I'm pretty sure that it's getting included twice somehow. I'm using blocks like this at all include points, on cpp and h files, to try to keep something from including twice: #ifndef CLASS_A_INC #define CLASS_A_INC #include "CLASS_A.h" #endif Despite all this I can't get the linking errors to go away. Help please? The question "Do computers think?" is the same as "Can submarines swim?" Signature Red Studios Jeryth

    C / C++ / MFC help question c++ com

  • newbie needs help
    J Jeryth

    Sick people :wtf:X| . . . teaching pointer arithmetic to beginners.:cool: The question "Do computers think?" is the same as "Can submarines swim?"

    C / C++ / MFC help csharp c++ database visual-studio

  • Crazy drivers
    J Jeryth

    Wouchies!! Like everyone else, my sympathies. And rest assured, my Honda freakof a friend mourns your loss. Had a similar experience about 3.5 years ago. Was living in Florida for a few years, luckily most people know how to drive in rain there, actually I learned how while there. Was headed west thru downtown Gainesville about 9PM and came to an intersection where the light turned green about 5 sec before. My buddy in the passenger side made some kind of exclamation and I saw headlights streaking from the north. I smashed my little Prizm into an Explorer headed south at about 60mph. The collision flipped my in a 180 and I stayed in the intersection. The crazy driver did a 270 and ended up facing west on the sidewalk, all the tires were sucked into/off of the wheels, depending on the side. Good thing I wasn't going 5mph faster or he would've hit me and my buddy would've had the impact. Also, if I was going 5mph slower I would have missed him but he would've ran over a motorcycle going the other way. Surprisingly enough the worst injury I had was the airbag getting my legs nice and toasty before I could get out. Like your case, I'm not sure the driver was licensed and he was borrowing his friend's Explorer. That got the cops all excited. That and his explanation that the light had "just turned green and I was trying to catch it." Speed limit of 35 and he guns it to 60 to catch a light, go figure. I've decided there are three types of drivers: good ones, bad ones, and dangerous ones. Good drivers are, well, good. The bad ones don't check their blind spots, never use turn signals, freak out when driving in inclement weather, you know, all that annoying stuff. Dangerous drivers are actually very good in terms of driving skill, they just drive too fast, too aggressive, all that. The only reason they aren't dead is because they are such good drivers. Just curious from the photos, looks like some cars were in front of you. How many total were involved? And how in the world does an unlicensed person have auto insurance? Don't all companies require proof of that to sell policies? The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    The Back Room csharp com learning

  • Join an anti-war group and support the war
    J Jeryth

    ColinDavies wrote: I think most were actually ... Anit-Logic.:laugh::laugh::laugh: Hole-in-One, hit it on the head, bullseye, ... The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    The Back Room question announcement

  • Is there no decent Java IDE out there?
    J Jeryth

    Michael A. Barnhart wrote: I hope they were doing some server side programming and not just basic apps. If only, if only... Here's a smidgeon of what we've been doing. Project 4[^] Real useful, yeah... I'm not sure which is worse, that we're not given anything remotely challenging or that the instructor tells us exactly how to do it. First, there's no creative freedom allowed, second, how can you learn when you're told exaclty what to do. And yes, we get docked if we do it a different way than what is outlined, unless we really improve on the program and go beyond what was required. The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    The Back Room visual-studio question c++ java com

  • Is there no decent Java IDE out there?
    J Jeryth

    Tell my Comp Science department that... I've already tried. For some astounding but undisclosed reason, they dropped most classes on C++ and switched them to Java. I think it had to do with the myth that "all programming is going to the wonderful platform independent language, Java.":wtf: No, that's asking for too much stupidity in them believing such a thing.:rolleyes: The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    The Back Room visual-studio question c++ java com

  • How to duplicate an object?
    J Jeryth

    Very true, I hadn't thought of default = difficulties originally. If your class is just a bunch of int, double, etc the default = operator should work. But if you have char arrays, strings and other more complicated vars, definitely define your own = operator. The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    C / C++ / MFC com tutorial question

  • DirectShow (DirectX) on CD
    J Jeryth

    I have it on CD, it came with a book I got on DX 9.0 Rendering Engines. It's the DX 9.0a SDK I'm pretty sure. I've got the 8.1 SDK too if you like. If you'd trust me with an address I suppose I could mail you a burned CD of it. Wow, it'd actually be legal too since it's a free DL anyway! Just use the contact link on my website below to get in touch if you care to. The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    C / C++ / MFC c++ graphics game-dev help

  • How to duplicate an object?
    J Jeryth

    Something along the lines of

    *pMyVar2 = *pMyVar1;

    I just made a simple program that does the same thing and it works.

    #include
    using namespace std;

    class Class1
    {
    public:
    int var1;
    int var2;
    };

    int main()
    {
    Class1 * object1 = new Class1();
    Class1 * object2 = new Class1();

    object1->var1 = 1;
    object1->var2 = 3;
    
    object2->var1 = 2;
    object2->var2 = 4;
    
    cout << "Object1 Var1 = " << object1->var1 << endl;
    cout << "Object1 Var2 = " << object1->var2 << endl;
    cout << "Object2 Var1 = " << object2->var1 << endl;
    cout << "Object2 Var2 = " << object2->var2 << endl << endl;
    
    \*object2 = \*object1;
    cout << "Object2 Var1 = " << object2->var1 << endl;
    cout << "Object2 Var2 = " << object2->var2 << endl;
    
    delete object1;
    object1 = NULL;
    delete object2;
    object2 = NULL;
    
    system( "pause" );
    return 0;
    

    }

    object2 was switched in the output so I don't know why it wouldn't work for a more complicated class. The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    C / C++ / MFC com tutorial question

  • Is there no decent Java IDE out there?
    J Jeryth

    In my Java classes at college we use an abominable piece of software called BlueJ. Is it too much to ask that someone, anyone, produce a decent Java IDE? I'll admit I'm new to Java programming, indeed I prefer C++ an immense deal above it, but I have to take the classes to get my degree and no I haven't been exposed to much of the development software for it. What's even more disgusting is that the two languages are nearly 90% the same in syntax. I've stopped showing up to the Java classes for I have no desire to sit thru hours of lectures on good programming procedures and practices that I've known and followed for a few years now. Nor do I care for the book that uses some of the most confusing diagrams I have seen and isn't so much teaching Java but how to work with the author's own classes, "conveniently" included on the enclosed CD. All I do now is skim thru the book chapters, learn the syntax differences, and turn in the homework. The only days I show up for class are the days of a test. But since I've a few more classes required I at least want an IDE that I don't have to know how to work Unix, create file systems for projects, and that won't have errors saving the files every other attempt. All I'd like is something that I can load up, create a new blank project, import the moronic author's classes, and that has something resembling Microsoft's Intellisense ( type the object, put a . or -> and have it list the object memebers or something that displays the arguments needed when I type a function. ) Can someone, anyone, give me some suggestions? I've tried Visual J# a little, but it was a little confusing to me and I don't think it likes working with .java or .class files. The question "Do computers think?" is the same as "Can submarines swim?" DragonFire Software Jeryth

    The Back Room visual-studio question c++ java com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups