Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Greystoke on February 18, 2011, 05:38:35 am
-
I have a small-ish program that seems to works fine in the Code::Blocks terminal window (I get all the output, it exits normally). But if I go to a Linux terminal and run the same program, I get a segmentation fault. (Open a new terminal window, CD to the directory, do "./program".) Anyone have any ideas about this? What should be looking at?
I did compile it with -fprofile-arcs and -ftest-coverage flags, BTW.
Thanks!
-G
-
Do you try to read from a file or something similar, that depends on the working directory ?
If yes, check whether you test the vaildity of the (file- or whatever) handlers before using them.
-
No, I am not reading from any files. The profiling/gcov stuff does, however...
Oh bollocks. I reconfigured it to not do profiling and now it crashes in Code::Blocks, too! :)
But it runs fine (in CB anyway) if I use my debug profile/target. I can't find any culprits as to why there's a difference, either. (I'm rather new at this, so I am probably missing something obvious.)
-- G
-
The likely problem is your code is bad; as in you are reading or writing to memory you have to rights to access.
The above is not a topic for this site. Try cboard for code issues. http://cboard.cprogramming.com/general-programming-boards/
Tim S.
-
Actually, it was my own dumb fault; similar to my code being bad, but different.
I had set a 'program arguments' for my CB profile when executing that build target. I had forgotten about that when trying to run it manually. When I included the command line argument in a native terminal, it worked fine.
DOH! :)