Results 1 to 13 of 13
  1. Cash0 (C++) Stuck between a rock and a very, very hard place.


    (specifically problems with geany)

    For my programming assignment, I have to implement classes as .h files and the definitions of the functions in their respective interfaces as .cpp files. The problem is that, the text editor I use, geany, decides to read my .h files as C code, and classes don't exist in C, so I get error messages at literally everything (the worst one is that string is not a data type, funnnnn). I can't test my code because of this, so I literally cannot do anything but blindly code and hope that it will all work out (I have literally spend two days straight trying to bypass this issue).

    My TA's instructions to solve this issue was (it was a common issue):
    Spoiler


    Long term solution did absolutely nothing for me, and the short term solution is undone the moment I restart geany. I cannot do anything, and I feel that I am unable to properly do this assignment simply because geany is a massive douche. To make matters worse, my building is on lockdown for hours (and still going), so I'm pretty frustrated right now (had to walk to a computer lab in pouring rain). How do I solve this problem?

    General rundown of how my stuff looks:
    iostream in all .h files
    string in all .h files
    .h files for classes that have other classes
    corresponding .h files for each .cpp file (e.x user.cpp has #include "user.h"
    inclusion guards in all of my .h files)

    If requested, I can post what I have so far.

  2. Default Re: (C++) Stuck between a rock and a very, very hard place.


    For the filetype_extensions.conf, you COULD try just deleting the line, however I have no idea what kind of effects, adverse or otherwise, it would have. I've never used geany.

    As for the part about string not being a data type, if you haven't set "using namespace std;", you will have to reference string as "std::string". I don't know if you have done this or not, but those are the two things I can think of at this time.

    It has been a long time since I've worked in C++ (I should do something about that), so I cannot really think of much else at this time.

  3. Orbital Bee Cannon
    IGN: SaptaZapta
    Server: Kradia
    Level: 275
    Job: Hero
    Guild: Matriarchy
    Alliance: Peaceful

    Default Re: (C++) Stuck between a rock and a very, very hard place.


    Does the filetype_extensions.conf file have a C++ line? Try adding *.h to that (in addition to commenting out the C line).

    If that doesn't work, try changing the file names to .hpp.
    Hopefully your instructor won't mind, since you're still putting the class header in a separate file from its implementation, as required.

    I don't know geany at all, but some other editors get it right if you insert the following line as the first line in every .h file:
    Code:
    // Hey, geany, this is a C++ file
    (The exact text doesn't matter, what matters is that it's a C++ comment. C only allows /* */ style comments)

    Good luck.

  4. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Are you forced to use "Geany"?

    @SaptaZapta; Huh? As of C99 (Which is 13 years old now) you can have single line comments in C.

  5. Orbital Bee Cannon
    IGN: SaptaZapta
    Server: Kradia
    Level: 275
    Job: Hero
    Guild: Matriarchy
    Alliance: Peaceful

    Default Re: (C++) Stuck between a rock and a very, very hard place.


    Sorry to misguide (haven't used C in longer than that, unfortunately), but as of 8 years ago or so, that type of comment still worked on some emacs flavors and at least one Unix IDE whose name I forget but used file logic. I admit it's a rather desperate solution, that's why I put it third.

  6. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Yep.

    I don't want to delete anything in filetype because I might end up deleting something that shouldn't be deleted.

  7. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Could always back it up, or just copy it into notepad and see what happens.

  8. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Did you restart after editing conf file?

  9. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Restarted geany + VM multiple times. Nothing works.

  10. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Try renaming your header files to have the extension ".hpp".

    I use Geany primarily on Arch, though, and I haven't encountered this issue when editing C++ header files..

  11. Default Re: (C++) Stuck between a rock and a very, very hard place.


    Problem was that I suck at keeping track at header info.

  12. Default Re: (C++) Stuck between a rock and a very, very hard place.


    This isn't really a C++ problem, it's just a problem with your environment. Does it compile and build, or is it just a text editor?

  13. Default Re: (C++) Stuck between a rock and a very, very hard place.


    The problem was that I just suck at remembering all the headers I needed and where to put them.

  14.  

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •