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

Offline KenWhight

  • Single posting newcomer
  • *
  • Posts: 3
    • Ken Whight's Amateur Astronomy Site
Traditional 'C'
« on: Yesterday at 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: 7845
Re: Traditional 'C'
« Reply #1 on: Yesterday at 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: Yesterday at 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

  • Single posting newcomer
  • *
  • Posts: 3
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #2 on: Yesterday at 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: Yesterday at 08:33:47 pm by KenWhight »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7845
Re: Traditional 'C'
« Reply #3 on: Today at 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: 7845
« Last Edit: Today at 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

  • Single posting newcomer
  • *
  • Posts: 3
    • Ken Whight's Amateur Astronomy Site
Re: Traditional 'C'
« Reply #5 on: Today at 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