Author Topic: Error in build after add a class  (Read 3006 times)

Offline saritr

  • Single posting newcomer
  • *
  • Posts: 2
Error in build after add a class
« on: February 17, 2016, 06:15:08 pm »
I use Code::Blocks 13.12.
I created an new poject. At first (without adding new classes) the buils passes, but after I add new class (with the dialog) I got the following error:
(.text+0x20): undefined reference to `main'
 
I tried to search a solution and encounter a similar issue in stackover flow"
http://stackoverflow.com/questions/24537874/undefined-reference-to-main-after-adding-a-class-to-project

Only after I read and implement the soluttion I succeeded to build it (I'm using 13.12 on 64 bit Ubuntu 14.04. I get the same problem and it does seem to be the class addition dialog that is to blame. Use it to create the class files but Don't add it to the project. Right click the project title in the 'Projects' tab (left pane in window) and use the 'Add Files' from the context menu. Should compile ok then.)

Why doesn't it work properly?

CHAOS-THEORY

  • Guest
Re: Error in build after add a class
« Reply #1 on: February 17, 2016, 06:18:48 pm »
You can get the latest stable build version of code blocks which is 16.01 for Ubuntu here
Code::Blocks Ubuntu binaries, Download


Edit: Removed non-English content.
« Last Edit: February 20, 2016, 05:02:50 pm by MortenMacFly »

Offline saritr

  • Single posting newcomer
  • *
  • Posts: 2
Re: Error in build after add a class
« Reply #2 on: February 17, 2016, 06:58:47 pm »
I know...bot I want to know why there was a problem.

CHAOS-THEORY

  • Guest
Re: Error in build after add a class
« Reply #3 on: February 17, 2016, 07:42:29 pm »
It might be a bug in the old version, that's why i suggested that you update to 16.01.
I program in C, but let's dive into this, i just tried to replicate your problem in the new version but it doesn't seem to have any problems.
Maybe the class template have some typos, can you take a screenshot of your class box settings when you press new > class
I don't know where the template is, but if there's one it might be in /usr/share/codeblocks

Edit: Removed non-English content.
« Last Edit: February 20, 2016, 05:02:41 pm by MortenMacFly »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Error in build after add a class
« Reply #4 on: February 17, 2016, 08:57:36 pm »
Why doesn't it work properly?
There was a bug... i don't remember the exact cause, but i think there was a white space where it shouldn't be... You can post a full rebuild log of the not working project and i may can tell you what is wrong. You can also search the forum, or you can try to search in the svn log for a bugfix of the new class plugin... There should be the answer somewhere out there.

greetings