Learning Codebench

9 posts / 0 new
Last post
jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 month ago
Joined: 2019-04-13 19:29
Learning Codebench

Hi, I'm trying to learn Codebench. It's going okay, I think. I jumped into the deep end and I'm working on a project that has eighteen source files and it least that many headers. I'm moving it over from Cubic IDE. Many of the files have errors, but everytime it compiles. it does every file, errors and all, before stopping. It takes a minute or two. I'm wondering if there is a way to get it to stop compiling after the first error to save time. Also, is there a way to get it to stop displaying routine messages like the ones about deprecated functions? Another problem I have is that it seems like the make clean function deletes some (maybe all) of my source files. I admit there is a lot that I don't understand yet.

Rigo
Rigo's picture
Offline
Last seen: 2 years 6 months ago
Joined: 2011-01-24 21:55
Re: Learning Codebench

This isn't really a CodeBench problem, but I'll try and help as much as I can.

If your project compiled fine under Cubic but not CodeBench, I'm guessing you set CodeBench to automatically create the makefile for you, and this is where you may have lost some compiler switches. By default, CodeBench will add -Werror to the compiler switches. This means the compiler will stop on any error giving you a chance to fix it.

As for deprecated functions, the proper fix here is to not use them, they are deprecated for a reason. However, luckily GCC supports the -Wno-deprecated switch which will turn off all deprecated warnings. This should really be avoided though, as bugs may lurk underneath which could be masked by the use of this switch.

As for the "Clean" rule deleting your source files, again there appears to be an error in the makefile leading to .c files being deleted rather than the .o ones.

If you still have the original makefile you was using for Cubic, you can tell CodeBench to use that instead, and simply turn off the automatic makefile creation.

Hope this helps somewhat. Keep coding, it's worth it in the end.

Simon

salass00
salass00's picture
Offline
Last seen: 7 months 1 week ago
Joined: 2011-02-03 11:27
Re: Learning Codebench

@jwanderson88

If the makefile that you're using has the source code files (*.c/*.cpp) listed in OBJS (or whatever its equivalent variable is called) instead of object (*.o) files then that could explain why all files are compiled every time and why the clean rule deletes the source code files instead of any object files.

jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 month ago
Joined: 2019-04-13 19:29
Re: Learning Codebench

I'm back to learning CodeBench. I'm starting out simple and I believe I'm making progress. I have another problem that is tangentially related. I compiled a simple program with debugging. It's so simple that there aren't any include files. It looks like this.

/*

************************************************************
**
** Created by: codebench 0.55 (19.10.2017)
**
** Project: TestProject
**
** File:
**
** Date: 17-08-2021 03:04:53
**
************************************************************

*/
int main()
{
int x;

x = 3;
//printf("Hello, world\n");

return (0);
}

I run sdk:c/gdb. I use *file test* to load the exe file, test. It lists okay with *list*. It runs okay to the end with *run*. But if I try use any debug functions like *b 20* (setting a breakpoint at line 20) (the line that says "x = 3;") I get this when I use *run* (it should stop at the breakpoint):

Program received signal SIGBUS, Bus error.
0x00000000 in ?? ()

I tried compiling a similar program with Cubic IDE and I get the same thing. I reinstalled the latest SDK, version 53.30. This seems to be a system-wide problem.

I have an X5000 and I'm running the latest AmigaOS version, 4.1 - Final Edition Update 2. It might have started when I installed Update 2, I'm not sure when it started.

Thanks. Jeff Anderson.

jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 month ago
Joined: 2019-04-13 19:29
Re: Learning Codebench

So I got out my Micro. Luckily it still has Update 1 on it. It seems to be working normally. It looks like it is Update 2 related.

hypex
hypex's picture
Offline
Last seen: 4 months 2 weeks ago
Joined: 2011-09-09 16:20
Re: Learning Codebench

I'm not aware of any bus error but GDB has been broken for some time. Way before Update 2 and I would estimate at least 7 years back luck. The build process for GDB on OS4 is rather complicated so looks like it only happened once.

In any case I recommend Spotless. A source code debugger and spawn of DB101. I had trouble getting it to work which always happens to me because I never know the right compile options to use but hopefully you have better luck.

http://os4depot.net/?function=showfile&file=development/debug/spotless.lha

walkero
walkero's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2009-05-03 16:54
Re: Learning Codebench

There is a problem with GDB on X5000. Not even spotless will work with that. There is some people who are working on it, but nothing was released yet.

There is a long discussion on the matter at Amigans.net

jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 month ago
Joined: 2019-04-13 19:29
Re: Learning Codebench

I feel like I'm making good progress with CodeBench. However I'm running into some problems during the linking phase. Could be missing libraries. The error list looks like this:

/tmp/ccq4aFIY.o: In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
main.cpp:(.text+0x4c): undefined reference to `std::string::size() const'
main.cpp:(.text+0xac): undefined reference to `std::string::operator[](unsigned int) const'
main.cpp:(.text+0x124): undefined reference to `std::string::operator[](unsigned int) const'
main.cpp:(.text+0x1b0): undefined reference to `std::string::operator[](unsigned int) const'
/tmp/cc7uiXm1.o: In function `CMainFrame::~CMainFrame()':
MainFrm.cpp:(.text+0x5d4): undefined reference to `operator delete(void*)'
/tmp/cc7uiXm1.o: In function `CMainFrame::~CMainFrame()':
MainFrm.cpp:(.text+0x828): undefined reference to `operator delete(void*)'
/tmp/ccq3hePP.o: In function `CCampUncannyApp::InitInstance()':
CampUncanny.cpp:(.text+0x44c): undefined reference to `operator new(unsigned int)'
CampUncanny.cpp:(.text+0x494): undefined reference to `operator delete(void*)'

There are a lot more instances of problems with new and delete operators. Aren't new and delete normal c++ functions?

Thanks

jwanderson88
jwanderson88's picture
Offline
Last seen: 2 years 1 month ago
Joined: 2019-04-13 19:29
Re: Learning Codebench

I solved the problem myself by changing the compiler in the makefile script from gcc to g++. Now it is compiling. The project I'm working is a game I've mentioned I've been calling Black Fang. I'm calling it Camp Uncanny now. So it is a significant piece of software with multiple source file. Getting it to work with CodeBench, which is being supported, is part of my move away from Cubic IDE, which hasn't been supported for many years. It also has a lot of useful features that I'm becoming familiar with.

Log in or register to post comments