Author Topic: Traditional 'C'  (Read 1688 times)

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Traditional 'C'
« on: November 09, 2026, 12:48:10 pm »
I am having to migrate from "Microsoft Visual C++ 2008" due to Windows 11 incompatibility. I have legacy software and only write text driven console programs in traditional 'C' (I thought ANSI 'C' was a bad move!).
When I try to compile these programs using CodeBlocks I get a whole load of errors that I do not understand (my programming skill are firmly stuck in the 1980's) is there a 'C' compiler or settings within the GNU 'default' compiler that will make my problem go away?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7846
Re: Traditional 'C'
« Reply #1 on: November 09, 2026, 03:58:36 pm »
If you post the first 3 errors; I am willing to try to figure out how to fix some of them.
Please post the GCC version info.

Please read https://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Most important part from above link
Quote
Look at the "Build Log" NOT the "Build Message" tab
« Last Edit: November 09, 2026, 04:34:17 pm by stahta01 »
C Programmer working to learn more about C++.
On Windows 11 64 bit using MSys2 UCRT64.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #2 on: November 09, 2026, 08:18:33 pm »
Hello, Thanks for your offer of help, I have made progress since I made the post. Most errors were caused by my use of an ancient way of declaring a function. When I replaced for example:-

double myfunction(par1, par2)
char par1;
double par2;

by:-

double myfunction(char par1, double par2);

most of my problems went away except for one. As you can see from the attached screenshot all the functions defined in linalg.c are not recognised in profile.c and I don't know why. it all worked in visual c++.
Regards
Ken
« Last Edit: November 09, 2026, 08:33:47 pm by KenWhight »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7846
Re: Traditional 'C'
« Reply #3 on: November 10, 2026, 12:43:33 am »
Code::Blocks and GCC neither one has the linking magic that MSVC does.
You need to link to the libraries needed or add the missing source files.

Please read the FAQs

Tim S.
C Programmer working to learn more about C++.
On Windows 11 64 bit using MSys2 UCRT64.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7846
« Last Edit: November 10, 2026, 01:26:27 pm by stahta01 »
C Programmer working to learn more about C++.
On Windows 11 64 bit using MSys2 UCRT64.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #5 on: November 10, 2026, 03:43:49 pm »
Hi, all four files linalg and profile .c and .h are in the appropriate project folders (I should have expanded the folders in the left hand pane in the screenshot I attached) I assumed this was enough to get them all linked. I'll look at the FAQ's and see what I can discover.
Regards
Ken

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7846
Re: Traditional 'C'
« Reply #6 on: November 10, 2026, 05:53:05 pm »
Posting the build log instead of a screenshoot will allow others to help you
C Programmer working to learn more about C++.
On Windows 11 64 bit using MSys2 UCRT64.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #7 on: Yesterday at 10:53:43 am »
I've attached the build log, it doesn't seem too illuminating.
Is there a problem with giving the same names to the project and one each of two the .c and .h files?
Also I noticed that some variables in structures in my LINALG.H file are highlighted in green (rank, begin, end) does that indicate a problem?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1952
Re: Traditional 'C'
« Reply #8 on: Yesterday at 11:30:41 am »
Can you attach the cbp file?

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #9 on: Yesterday at 11:54:09 am »
Where do I find a .cbp file? I've looked but couldn't see any reference to it.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1952
Re: Traditional 'C'
« Reply #10 on: Yesterday at 12:09:20 pm »
It should be called Profile.cbp and reside in C:\Users\kenwh\Documents\Astronomy\Programs\Profile, near LINALG.C and Profile.c

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #11 on: Yesterday at 01:28:45 pm »
I tried uploading it but .cbp is not of an allowed file type for upload. I did try converting it to text after opening it in Word (which again looked pretty un-informative) but the resulting text file was blank.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1952
Re: Traditional 'C'
« Reply #12 on: Yesterday at 01:29:52 pm »
Just change the extension to .txt

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #13 on: Yesterday at 04:12:42 pm »
In the meantime... I've paired my code down to the bare minimum (it's not much more complicated than the basic "Hello World" program) that still reports the basic error (see attachments - one more to follow).

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #14 on: Yesterday at 04:15:20 pm »
last attachment.
It must be something really basic I'm missing  :-[ .

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1952
Re: Traditional 'C'
« Reply #15 on: Yesterday at 05:13:40 pm »
Do not send screen captures, just attach the files.

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #16 on: Yesterday at 06:42:37 pm »
Here's the code

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1952
Re: Traditional 'C'
« Reply #17 on: Yesterday at 07:42:39 pm »
The code compiled OK out of the box, so it must be a problem with the .cbp file you did not post.

I have reformatted the code a little (added guards, reordered struct declarations and declared square_matrix_create() in the .h). The .cbp file is included, so you can open it and compile.

Offline KenWhight

  • Multiple posting newcomer
  • *
  • Posts: 10
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #18 on: Yesterday at 09:00:23 pm »
Here's the .cbp file. It was created by the Console Application Wizard, I don't recall any options in the creation process. So am confused as to why it doesn't work.