Forum > Unix

External variable compilation error

<< < (2/2)

Roland57:

--- Quote from: Fred vS on October 29, 2020, 08:22:19 pm ---Hello Roland.

This compiles ok here:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program testvar; {$mode objfpc}{$H+} var  stdin: pointer; external 'libc';  stdout: pointer; external 'libc';  beginend.
--- End quote ---

Weird. Here it doesn't compile.

Here are my options:

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fpc -FcUTF8 -B -Mobjfpc -Sh -FUunits OpenCritter.dpr -o./critter32 -dDEBUG -ghl

Fred vS:

--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fred@fiens ~>fpc -B testvar.pas

--- Quote ---Free Pascal Compiler version 3.2.1[2020/08/24] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl & Others.
Target OS: Linux for x86-64
Compiling testvar.pas
testvar.pas(6,3) Note: Local variable "stdin" not used
testvar.pas(7,3) Note: Local variable "stdout" not used
Linking testvar
10 lines compiled, 0.1 sec
2 note(s) issued

--- End quote ---

Roland57:
OK, Fred, you are right. There was a {$mode delphi } in the head of the file. After I removed it, it compiles.

But maybe is it rather:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---external 'c'
 :-\

Fred vS:

--- Quote from: Roland57 on October 29, 2020, 08:54:51 pm ---But maybe is it rather:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---external 'c'
 :-\

--- End quote ---

If you want, it is the **great** feature of fpc, to auto-add 'lib' prefix (and auto-cut the 'so number').

;-°

Fre;D

Navigation

[0] Message Index

[*] Previous page

Go to full version