Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » PHP class "cannot be resolved to a type" error(Eclipse can't find the class declaration because the path is dynamic)
PHP class "cannot be resolved to a type" error [message #1840160] Wed, 07 April 2021 21:28 Go to next message
Gustavo Pinent is currently offline Gustavo PinentFriend
Messages: 5
Registered: April 2021
Junior Member
I've just installed Eclipse in my Macbook with Big Sur. I did open a folder with a website to work with as a project.

A lot of errors like "<classname> cannot be resolved as a type" is displayed. I have researched about this error and there is a lot of complains about, for many years. Sometimes, to modify .buildpath solve it, but my file is ok, it seems Eclipse is not finding the class declaration.

Here is the thing, as you can see below, my classes are in other files included by a dynamic path, so is only possible to know the source when running. Is there any solution or workaround to this issue?

<?php 
if($_SERVER["HTTP_HOST"]=="localhost"){
	ini_set("display_errors", "1");
	error_reporting(E_ALL ^ E_NOTICE);
}
$main = 'admin3.php';
require_once("sessao.php");
if($Erros) die('<h1>Erro de início de sessão</h1><p>'.implode('<br />', $Erros).'</p><p>Inicialização abortada!</p>');
$reloadMain = $Amb->url.$main;
$htmlUsuario = ($_SESSION["Login"]["Usuario"]["logado"])? 
	'Usuário: <b>'.$_SESSION["Login"]["Usuario"]["nome"].'&nbsp;<a href="#" onclick="info(\'usr\'); return false;"> ? </a>&nbsp;<a href="#" onclick="loginLogout(); return false;">Sair</a></b>'
	 : 'Usuário não logado' ;
// jGp
$jGp = ($Amb->host=="localhost")? $Amb->urlJGp."ini-1.1.js" : $Amb->urlJGp."ini_1.1.js" ;
$jGp_modFup = ($Amb->host=="localhost")? $Amb->urlJGp."modFup-1.1.js" : $Amb->urlJGp."modFup_1.1.js" ;
// bibs
require_once($Amb->dirBibPhp."BaseDeDados.php");
require_once($Amb->dirBibPhp."ListaDir_1.php");
//require_once($Amb->dirBibPhp."EchoPlus.php");
//require_once($Amb->dirBibPhp."TextoFuncs.php");
//$TF = new TF();
//$echo = new EchoPlus();
$BD = new BaseDeDados(); ***here is pointed an error***
...
Re: PHP class "cannot be resolved to a type" error [message #1840269 is a reply to message #1840160] Sat, 10 April 2021 22:01 Go to previous message
Gustavo Pinent is currently offline Gustavo PinentFriend
Messages: 5
Registered: April 2021
Junior Member
No answers yet? Where are the masters of this community???

Ok, what I did so far was just disable those errors, set to a simple message. But I still got 3 errors when I embed the facebook tools, but these ones I'm thinking in work differently of other libraries.

require($Amb->dirBibPhp.'Facebook/autoload.php');
//use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
Previous Topic:Having multiple source folders sharing same output target
Next Topic:How to use PDT as a standalone tool
Goto Forum:
  


Current Time: Thu Dec 12 17:39:24 GMT 2024

Powered by FUDForum. Page generated in 0.07123 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top