![]() |
|
(C++) Stuck between a rock and a very, very hard place. - Printable Version +- Southperry.net (https://www.southperry.net) +-- Forum: Social (https://www.southperry.net/forumdisplay.php?fid=14) +--- Forum: Rubik's Cube (https://www.southperry.net/forumdisplay.php?fid=58) +--- Thread: (C++) Stuck between a rock and a very, very hard place. (/showthread.php?tid=61372) |
(C++) Stuck between a rock and a very, very hard place. - Imagine - 2013-01-26 (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. (C++) Stuck between a rock and a very, very hard place. - Polantaris - 2013-01-26 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: tring". 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. (C++) Stuck between a rock and a very, very hard place. - SaptaZapta - 2013-01-26 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++ fileGood luck. (C++) Stuck between a rock and a very, very hard place. - Locked - 2013-01-26 Are you forced to use "Geany"? [MENTION=4093]SaptaZapta[/MENTION]; Huh? As of C99 (Which is 13 years old now) you can have single line comments in C. (C++) Stuck between a rock and a very, very hard place. - SaptaZapta - 2013-01-26 Locked Wrote:Are you forced to use "Geany"? 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. (C++) Stuck between a rock and a very, very hard place. - Imagine - 2013-01-26 Locked Wrote:Are you forced to use "Geany"? Yep. I don't want to delete anything in filetype because I might end up deleting something that shouldn't be deleted. (C++) Stuck between a rock and a very, very hard place. - Polantaris - 2013-01-26 Imagine Wrote:Yep. Could always back it up, or just copy it into notepad and see what happens. (C++) Stuck between a rock and a very, very hard place. - happylight - 2013-01-26 Did you restart after editing conf file? (C++) Stuck between a rock and a very, very hard place. - Imagine - 2013-01-26 happylight Wrote:Did you restart after editing conf file? Restarted geany + VM multiple times. Nothing works. (C++) Stuck between a rock and a very, very hard place. - AngelSL - 2013-01-26 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.. (C++) Stuck between a rock and a very, very hard place. - Imagine - 2013-01-27 Problem was that I suck at keeping track at header info. (C++) Stuck between a rock and a very, very hard place. - Dusk - 2013-01-27 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? (C++) Stuck between a rock and a very, very hard place. - Imagine - 2013-01-27 Dusk Wrote: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? The problem was that I just suck at remembering all the headers I needed and where to put them. |