Unable to find main lpr file when compiling lazarus / 9-Editor ---------------------------------------------------------------------- InRong · 2015-08-12 12:03 Hi, when I compile, I am now getting the error in messages "Error: undefined reference to `mysql_port`" which is easily understood if it cannot load the mysql.inc.... However, if I click on the line in the IDE, then I can find the declaration, then it opens the mysql.inc file. Worse, if I click on the line in Messages, I get the following: QuoteUnable to find file "rcl_logana4.lpr". If it belongs to your project, check search path in Project -> Compiler Options -> Search Paths -> Other Unit Files. If this file belongs to a package, check the appropriate package compiler options. If this file belongs to Lazarus, make sure compiling clean. If the file belongs to FPC then check fpc.cfg. If unsure, check Project -> CompilerOptions -> Test Where rcl_logana4.lpr is unsurprisingly my one and only source file... I have just upgraded from CentOS6.5 to CentOS 7.1 on this machine, and it was OK before that, so suspect something might be missing or just different. FPC: 2.6.4-1 FPC-Src: 2.6.4-140420 Lazarus: 1.4.2-0 These are all on basic 64bit Intel based. It is in a VirtualBox as well, but not sure how that might change stuff TIA ---------------------------------------------------------------------- InRong · 2015-08-12 13:10 To add some minor detail, the Error in Messages is correct, but the error when I click on it is still confusing I seem to have managed to change to LinkDynamically, not a bad thing, but that symbol is only defined if not doing so.... It doesn't however explain the strange message when clicking on the error, but does mean it works when there are no errors.... I was only displaying the value anyway, so it was not needed. ---------------------------------------------------------------------- jc99 · 2015-08-13 06:51 When I am on Linux, i have those strange messages when the case of the filename and the name of the Program, unit, library ... don't match. Could you check that ? Maybe showing/uploading the project would be a good thing. Because it's hard to tell without source. (Or some lines of source) ---------------------------------------------------------------------- InRong · 2015-08-13 13:06 Hi, everything seems to be lowercase, so doesn't seem to be the issue this time. This is an old project that was initially created in 0.9 or maybe earlier. I recently need to add to it, so I updated to 1.4.2 on Centos6.5, and it compiles OK, so I did not see if this issue occurred at this point. I then updated to Centos7, which was a bit of a task, but have it working now (I think....). There are 2000 lines, all in one file rcl_logana4.lpr, so I will post just a snippet. My workaround is just not to have any coding errors..... Easier said than done lol.. I think this is an IDE/base OS issue, quite possibly an issue in setup, or even something like just suggested with case sensitivity. I have just looked, and it does find the file and show the correct line of code for the hints (all just unused parameters in callbacks), it is just this error. Even stranger, I removed a comma earlier in the file, and this gives a sensible error, which also shows up correctly in the code... Therefore, it is related to the use of that variable somehow... I am assuming there are no major flaws in the mysql55 code as I would expect it to be well enough used by now. Well, I will stop rambling for a moment.. Code: [Select]program rcl_logana4; {$mode objfpc}{$H+} uses {$IFDEF UNIX} {$IFDEF UseCThreads}   cthreads, {$ENDIF} {$ENDIF}   contnrs,   SysUtils,   CustApp,   { you can add units after this }   BaseUnix,   Math,   mysql55, Classes, lNet; const                   //default values [snip]   // The errored parts are totally irrelevant, so I just remove them to workaround the initial error.       writeln('Mysql_port      : ', mysql_port);       //writeln('Mysql_unix_port : ', mysql_unix_port); [snip] var   Application: tRCL_main; {$R *.res} begin   Application := tRCL_main.Create(nil);   Application.OnException := @Application.CustomExceptionHandler;   Application.FileVersion:='0.1.0.15';   Application.Run;   Application.Free; end. ---------------------------------------------------------------------- tk · 2015-08-13 14:07 Check search paths for the project. They should not contain any package paths, rather the packages should be in project require clause. If your project only resides in one directory the search paths in Project options should be empty. I had such errors with old projects as well, because this some old Lazarus versions needed some search paths, I don't remember exactly anymore. Btw. I think the project should have the Interfaces unit in the uses clause (on second place because you use cthreads). But the IDE should complain about it as well. ---------------------------------------------------------------------- InRong · 2015-08-13 14:27 There was an old package in there, so I have moved lNet from a directory into the IDE, but nothing. Interfaces I think is less needed as this is old enough to be a command line tool.... This is also why I need to add the mysql library into the library path, as I don't think I am using the IDE mysql access (well not fully anyway) I have done some more checking, and note this is a linker related issue. If I change it from the mysql variables to xxxxxx then I get a compiler error, and all is OK, but this is what I get for the mysql error, with it complaining about all mysql variables, whereas with xxxxxx it stops on the first error. Code: [Select]Compile Project, Target: rcl_logana4: Exit code 1, Errors: 3, Hints: 7 rcl_logana4.lpr(181,39) Hint: Parameter "SigInf" not used rcl_logana4.lpr(181,56) Hint: Parameter "sigCtx" not used rcl_logana4.lpr(172,21) Hint: Parameter "aSocket" not used rcl_logana4.lpr(159,30) Hint: Parameter "f" not used rcl_logana4.lpr(144,39) Hint: Parameter "aSocket" not used rcl_logana4.lpr(150,22) Hint: Parameter "aSocket" not used rcl_logana4.lpr(114,30) Hint: Parameter "f" not used /home/alan/pascal/svn_rcl/lib/x86_64- linux/libprcl_logana4.a(rcl_logana40s19.o): In function `TRCL_LOGGER__DB_CONNECT': rcl_logana4.lpr(508,1) Error: undefined reference to `mysql_port' rcl_logana4.lpr(509,1) Error: undefined reference to `mysql_unix_port' Error: Error while linking The related section from mysql.inc is: Code: [Select]{$IFNDEF LinkDynamically}       var          mysql_port : cuint;cvar;external;          mysql_unix_port : Pchar;cvar;external; {$ENDIF} Is this an issue with the IDE, or just with how I am using it? ---------------------------------------------------------------------- tk · 2015-08-13 14:59 Never thought a variable could have an external declaration. Have been using only statically linked functions so far.. Anyway maybe the linker does not support this anymore, so the dynamic linking would help (mean the LinkDynamically directive). So you could examine the problem at runtime.