Author Topic: Segfault only with Project  (Read 3904 times)

Offline Smokesr

  • Single posting newcomer
  • *
  • Posts: 2
Segfault only with Project
« on: November 16, 2013, 01:02:47 pm »
I am running Code::Blocks version 12.11 on LMDE (based on Debian Testing).
The compiler I use is g++
version (Debian 4.7.3-4) 4.7.3

I have two classes in header files and cpp files as the c++ reference book recommend it and also have a main.cpp which use the classes.
I set the headers path to project build options > search directories > compiler, so i dont need to write the full path of headers when i include them.
The classes have some pointer inside them.

My problem is when i compile this as a project, i've got segmentation fault, but if i make it without a project, and include the full path of headers its works fine.
And of course, when i copy the class implementations and specifications to the main file and compile its work fine.

Build log:
Code
||=== Build finished: 0 errors, 0 warnings (0 minutes, 0 seconds) ===|

When i try to run:
Code
Segmentation fault

Process returned 139 (0x8B)execution time    0.054 s
Build log:
Code
Checking for existence: /home/smoke/sdl2/2d_test/bin/Debug/2d_test
Executing: xterm -T 2d_test -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/home/smoke/sdl2/2d_test/:/usr/lib/x86_64-linux-gnu /home/smoke/sdl2/2d_test/bin/Debug/2d_test  (in /home/smoke/sdl2/2d_test/.)
Process terminated with status 0 (0 minutes, 1 seconds)

I have already tried compile it from terminal with headers on same directory and worked. So i think the problem causes the header search.
« Last Edit: November 16, 2013, 02:27:11 pm by Smokesr »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Segfault only with Project
« Reply #1 on: November 16, 2013, 01:41:18 pm »
I set the headers path to project build options > search directories > resource compiler

why resource compiler? You have to set it in search directories-> compiler...
does it even compile?

pleas read also this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

and report a full build log
greetings

Offline Smokesr

  • Single posting newcomer
  • *
  • Posts: 2
Re: Segfault only with Project
« Reply #2 on: November 16, 2013, 02:20:43 pm »

why resource compiler? You have to set it in search directories-> compiler...
does it even compile?

pleas read also this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

and report a full build log
greetings

Thank you for your help. I modified my post.

I tried your recommendation but the problem is still exist.
« Last Edit: November 16, 2013, 02:23:02 pm by Smokesr »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Segfault only with Project
« Reply #3 on: November 16, 2013, 03:11:31 pm »
pleas read also this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F


You should post a full build log; this requires you to re-build the whole project!

And, post a full build log
or expect no more help!
« Last Edit: November 16, 2013, 03:26:19 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Segfault only with Project
« Reply #4 on: November 16, 2013, 03:14:35 pm »
Or try to use a debugger to understand where and why it is crashing.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]