Author Topic: C Compiler can't find source  (Read 317 times)

gddeluca

  • Newbie
  • *
  • Posts: 4
    • View Profile
C Compiler can't find source
« on: June 04, 2024, 01:11:50 PM »
I've tried several of the demo files and had no problem. I was more interested in GUI's with Tab support and copied the TabReOrderAnchor.bas source to look at, but cannot get it to compile. I selected the Pelles C compiler and GUI.

It seems the C output is .CPP but Pelles wants .C

How do I fix this?

I get:
BCX BASIC to C/C++ Translator (c) 1999-2024 by Kevin Diggins
Version 8.0.8 (12/27/2023) Compiled using MS Visual C++ for 64-bit Windows Systems
[Lines In: 553] [Lines Out: 1336] [Statements: 441] [Time: 0.03 Sec's]
BCX translated [Tabs.Bas] to [Tabs.Cpp] for a C++ Compiler
"C:\Users\George Deluca\Desktop\Tabs".c was not found. Operation aborted.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: C Compiler can't find source
« Reply #1 on: June 04, 2024, 01:17:03 PM »
George,

I'm not familiar with TabReOrderAnchor.bas but I'll have a look, if you provide a link.


I found this:

https://bcxbasiccoders.com/bcxusers/ian/programs/TabReOrderAnchor.zip

I unzipped, compiled, and ran using BED ...  (Pelles reported 2 minor warnings)

Your output is very strange:

Version 8.0.8 (12/27/2023) Compiled using MS Visual C++ for 64-bit Windows Systems
[Lines In: 553] [Lines Out: 1336] [Statements: 441] [Time: 0.03 Sec's]
BCX translated [Tabs.Bas] to [Tabs.Cpp] for a C++ Compiler
"C:\Users\George Deluca\Desktop\Tabs".c was not found. Operation aborted.



When I compile it in BED using 808, I get this:

BCX BASIC to C/C++ Translator (c) 1999-2024 by Kevin Diggins
Version 8.0.8 (12/27/2023) Compiled using MS Visual C++ for 64-bit Windows Systems
[Lines In: 556] [Lines Out: 1386] [Statements: 430] [Time: 0.03 Sec's]
BCX translated [Tabreorderanchor.Bas] to [Tabreorderanchor.C] for a C Compiler
**************************************************************************
Pelles C is compiling [ "C:\Temp\TabReOrderAnchor".c ] as a 64-bit GUI application.
Pelles C built [ "C:\Temp\TabReOrderAnchor".exe ]
C:\Temp\TabReOrderAnchor.c(1354): warning #2116: Local 'i' is used without being initialized (or using a dangling value).
C:\Temp\TabReOrderAnchor.c(1361): warning #2229: Local 'tmphWnd' is potentially used without being initialized (or using a dangling value).

« Last Edit: June 04, 2024, 05:20:50 PM by MrBcx »

Robert

  • Hero Member
  • *****
  • Posts: 1190
    • View Profile
Re: C Compiler can't find source
« Reply #2 on: June 04, 2024, 01:53:15 PM »

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: C Compiler can't find source
« Reply #3 on: June 04, 2024, 02:04:01 PM »
Tabreorderanchor.Bas is in the Documentation at

https://bcxbasiccoders.com/webhelp/html/guisamples/tabreorderanchor.htm

Thanks Robert ... seems to be the same code as the zip that I linked.

I copied the source from BCX Help, pasted into BED
, compiled with Pelles C,
and got the same 2 minor warnings that I reported earlier. 

The sample ran as expected.

I wonder if George modified his copy of the source code.

ADDED LATER:   Clearly something is different

George's output:
[Lines In: 553] [Lines Out: 1336] [Statements: 441]

My output:
[Lines In: 536] [Lines Out: 1386] [Statements: 430]

using BCX version 8.0.8
« Last Edit: June 04, 2024, 05:20:10 PM by MrBcx »

Pietro54

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: C Compiler can't find source
« Reply #4 on: June 05, 2024, 06:25:37 AM »
I compiled Bcx_Tab_Demo.Bas with my old bat files and get the following errors:

BCX BASIC to C/C++ Translator (c) 1999-2024 by Kevin Diggins
Version 8.0.8 (12/27/2023) Compiled using MS Visual C++ for 32-bit Windows Systems
[Lines In: 536] [Lines Out: 1386] [Statements: 430] [Time: 0.06 Sec's]
BCX translated [Bcx_Tab_Demo.Bas] to [Bcx_Tab_Demo.C] for a C Compiler

Pelles Compiler & Linker:
-------------------------
BCX_Tab_Demo.c(1243): warning #2018: Undeclared function 'GetDpiForSystem' (did you mean: ?); assuming 'extern' returning 'int'.
BCX_Tab_Demo.c(1261): warning #2018: Undeclared function 'GetSystemMetricsForDpi' (did you mean: ?); assuming 'extern' returning 'int'.
BCX_Tab_Demo.c(1265): warning #2018: Undeclared function 'GetSystemMetricsForDpi' (did you mean: ?); assuming 'extern' returning 'int'.
BCX_Tab_Demo.c(1354): warning #2116: Local 'i' is used without being initialized (or using a dangling value).
BCX_Tab_Demo.c(1361): warning #2229: Local 'tmphwnd' is potentially used without being initialized (or using a dangling value).
POLINK: error: Unresolved external symbol '_GetDpiForSystem' - referenced from 'BCX_Tab_Demo.obj'.
POLINK: error: Unresolved external symbol '_GetSystemMetricsForDpi' - referenced from 'BCX_Tab_Demo.obj'.
POLINK: fatal error: 2 unresolved external(s).


I compiled with BED and everything works.

I compared my PW32.bat file with that of BED and saw that the difference lies in the parameter
 SET PoccOPTS= .... /D_WIN32_WINNT=0x601 ....
which needs to be changed to
 SET PoccOPTS= .... /D NTDDI_VERSION=0x0A000007 ....
for everything to work again.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: C Compiler can't find source
« Reply #5 on: June 05, 2024, 08:01:54 AM »
I compiled Bcx_Tab_Demo.Bas with my old bat files and get the following errors:

BCX BASIC to C/C++ Translator (c) 1999-2024 by Kevin Diggins
Version 8.0.8 (12/27/2023) Compiled using MS Visual C++ for 32-bit Windows Systems
[Lines In: 536] [Lines Out: 1386] [Statements: 430] [Time: 0.06 Sec's]
BCX translated [Bcx_Tab_Demo.Bas] to [Bcx_Tab_Demo.C] for a C Compiler

Pelles Compiler & Linker:
-------------------------
BCX_Tab_Demo.c(1243): warning #2018: Undeclared function 'GetDpiForSystem' (did you mean: ?); assuming 'extern' returning 'int'.
BCX_Tab_Demo.c(1261): warning #2018: Undeclared function 'GetSystemMetricsForDpi' (did you mean: ?); assuming 'extern' returning 'int'.
BCX_Tab_Demo.c(1265): warning #2018: Undeclared function 'GetSystemMetricsForDpi' (did you mean: ?); assuming 'extern' returning 'int'.
BCX_Tab_Demo.c(1354): warning #2116: Local 'i' is used without being initialized (or using a dangling value).
BCX_Tab_Demo.c(1361): warning #2229: Local 'tmphwnd' is potentially used without being initialized (or using a dangling value).
POLINK: error: Unresolved external symbol '_GetDpiForSystem' - referenced from 'BCX_Tab_Demo.obj'.
POLINK: error: Unresolved external symbol '_GetSystemMetricsForDpi' - referenced from 'BCX_Tab_Demo.obj'.
POLINK: fatal error: 2 unresolved external(s).


I compiled with BED and everything works.

I compared my PW32.bat file with that of BED and saw that the difference lies in the parameter
 SET PoccOPTS= .... /D_WIN32_WINNT=0x601 ....
which needs to be changed to
 SET PoccOPTS= .... /D NTDDI_VERSION=0x0A000007 ....
for everything to work again.

Hi Pietro54,

This post from a 2021 thread is still relevant:

https://bcxbasiccoders.com/smf/index.php?topic=537.msg2439#msg2439


Also, this MS page provides some useful information for our forum members who prefer older versions of Windows:

https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers

« Last Edit: June 05, 2024, 08:27:01 AM by MrBcx »

gddeluca

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: C Compiler can't find source
« Reply #6 on: June 06, 2024, 08:53:38 AM »
OK guys, I now have it working.

Two Problems
1) Whan I cut/pasted the source, I picked up a few text lines at the top, NOT marked as comments. These seemed to throw the compiler off.

2) After commenting those lines, it STILL wouldn't compile, complaining about a missing file. It doesn't seem to like paths with embedded blanks. So I created a new folder under my D:\Documents and moved the source in there. It now compiles OK with the same 2 minor errors.

I originally had the source just sitting on the Windows Desktop, which is where I put stuff that I'm currently just 'playing' with. But my USER name is 'George Deluca', with the space. Surprisied by that, very few apps still have problems with embedded blanks.

That might be worth correcting eventually, but I'm happy with it now.

Thank you all for your comments

George

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: C Compiler can't find source
« Reply #7 on: June 06, 2024, 08:59:40 AM »
OK guys, I now have it working.

Two Problems
1) Whan I cut/pasted the source, I picked up a few text lines at the top, NOT marked as comments. These seemed to throw the compiler off.

2) After commenting those lines, it STILL wouldn't compile, complaining about a missing file. It doesn't seem to like paths with embedded blanks. So I created a new folder under my D:\Documents and moved the source in there. It now compiles OK with the same 2 minor errors.

I originally had the source just sitting on the Windows Desktop, which is where I put stuff that I'm currently just 'playing' with. But my USER name is 'George Deluca', with the space. Surprisied by that, very few apps still have problems with embedded blanks.

That might be worth correcting eventually, but I'm happy with it now.

Thank you all for your comments

George

George -- glad you got it sorted out.

Pelles C (in particular) -HATES- paths with spaces in them.  Most other compilers tolerate them.


Added:

Also thank you for the follow-up.  Sharing our experiences helps others.


Added later still ...

The next version of BED will include a Tool-Tip over the Pelles C Compiler option
with a reminder about program paths containing spaces.  (See screenshot)





« Last Edit: June 06, 2024, 10:47:27 AM by MrBcx »