plog
plog copied to clipboard
Getting compilation error Rad Studio
Hi , I was configuring Plog with my project in CodeGear RAD studio. I have a doubt, when i unzip the plog-1.1.4.zip, i found "plog" is under "include" folder but document says "Add plog/include to the project include paths". Which i though wrong so added "include/plog" in my project include path.
After that when i compiled i got error in util.h and WinApi.h for which i attached the screen shot. Please help me to resolve the compilation error.
Hi @uttam-bhanu ,
Please try rad-studio-compile-fix-137 branch.
Also I hope the following diagram will make it clear what include folders to add:
plog <==== root folder
|
|- include <==== add this path to includes
| |
| \- plog
|- samples
Hi Sergius, Thanks for your response!! please let me how to find the location of fix, because when I tried to find the patch I did not find that.
Thanks, Uttam
Here is a zip archive: https://github.com/SergiusTheBest/plog/archive/rad-studio-compile-fix-137.zip
Hi Sergius,
Thank you for the link! but still i am getting compilation error. I have included the path correctly. First time i get the below error in Util.h [BCC32 Error] Util.h(66): E2034 Cannot convert 'const long *' to 'tm *' [BCC32 Error] Util.h(66): E2342 Type mismatch in parameter 't' (wanted 'tm *', got 'const long *').
above error corresponding to line 66 of code in util.h: inline void localtime_s(struct tm* t, const time_t* time) { #if defined(_WIN32) && defined(BORLANDC) ::localtime_s(time, t);=====> here
for this i just did a hack , i again inlcuded winapi.h in last as below: ....... ....... ....... #include <plog/WinApi.h>
namespace plog { namespace util { #ifdef _WIN32
this resolve the above two error in util.h but again in WinApi.h i get error as below which looks expected: [BCC32 Error] WinApi.h(22): E2238 Multiple declaration for 'CRITICAL_SECTION' [BCC32 Error] WinApi.h(21): E2344 Earlier declaration of 'CRITICAL_SECTION' [BCC32 Error] WinApi.h(32): E2238 Multiple declaration for 'COORD'
it could be because i have added winapi.h file again in util.h
Please suggest how can i get rid of this.
Thanks, Uttam
Ok, try to change this line https://github.com/SergiusTheBest/plog/blob/rad-studio-compile-fix-137/include/plog/WinApi.h#L6 to #if 0
I have tried replacing L6 to #if 0 ,then again getting error from line 90 onward. i kept on commenting the erroneous code just to narrow down the case but found that i have to comment till end. And finally land to original problem along with original issue. Even though my hack is present.
Below is the original issue i faced mainly in (Util.h,Record.h,WinApi.h):
[BCC32 Error] Util.h(67): E2034 Cannot convert 'const long *' to 'tm *' [BCC32 Error] Util.h(67): E2342 Type mismatch in parameter 't' (wanted 'tm *', got 'const long *') [BCC32 Error] Util.h(82): E2034 Cannot convert 'const long *' to 'tm *' [BCC32 Error] Util.h(82): E2342 Type mismatch in parameter 't' (wanted 'tm *', got 'const long *') [BCC32 Error] Record.h(76): E2293 ) expected [BCC32 Error] Record.h(79): E2299 Cannot generate template specialization from 'isStreamable<T,Stream>' [BCC32 Error] Record.h(81): E2270 > expected [BCC32 Error] Record.h(85): E2428 Templates must be classes or functions [BCC32 Error] WinApi.h(24): E2238 Multiple declaration for 'CRITICAL_SECTION' [BCC32 Error] WinApi.h(23): E2344 Earlier declaration of 'CRITICAL_SECTION' [BCC32 Error] WinApi.h(34): E2238 Multiple declaration for 'COORD' [BCC32 Error] WinApi.h(33): E2344 Earlier declaration of 'COORD' [BCC32 Error] WinApi.h(40): E2238 Multiple declaration for 'SMALL_RECT' [BCC32 Error] WinApi.h(39): E2344 Earlier declaration of 'SMALL_RECT' [BCC32 Error] WinApi.h(48): E2238 Multiple declaration for 'CONSOLE_SCREEN_BUFFER_INFO' [BCC32 Error] WinApi.h(47): E2344 Earlier declaration of 'CONSOLE_SCREEN_BUFFER_INFO' [BCC32 Error] WinApi.h(92): E2238 Multiple declaration for 'kActive'
So I have removed my hack from util.h. Please let me know what i can do further.
Thanks, Uttam
It's strange. Could you create a sample project and attach it here? Also which version of RAD Studio do you use?
Sergey suggested you change line 6 to #if 1, and you say you tried #if 0. Did you also try #if 1?
On Wed, Aug 14, 2019 at 9:11 AM uttam-bhanu [email protected] wrote:
I have tried replacing L6 to #if 0 ,then again getting error from line 90 onward. i kept on commenting the erroneous code just to narrow down the case but found that i have to comment till end. And finally land to original problem along with original issue. Even though my hack is present.
Below is the original issue i faced mainly in (Util.h,Record.h,WinApi.h):
[BCC32 Error] Util.h(67): E2034 Cannot convert 'const long *' to 'tm *' [BCC32 Error] Util.h(67): E2342 Type mismatch in parameter 't' (wanted 'tm *', got 'const long *') [BCC32 Error] Util.h(82): E2034 Cannot convert 'const long *' to 'tm *' [BCC32 Error] Util.h(82): E2342 Type mismatch in parameter 't' (wanted 'tm *', got 'const long *') [BCC32 Error] Record.h(76): E2293 ) expected [BCC32 Error] Record.h(79): E2299 Cannot generate template specialization from 'isStreamable<T,Stream>' [BCC32 Error] Record.h(81): E2270 > expected [BCC32 Error] Record.h(85): E2428 Templates must be classes or functions [BCC32 Error] WinApi.h(24): E2238 Multiple declaration for 'CRITICAL_SECTION' [BCC32 Error] WinApi.h(23): E2344 Earlier declaration of 'CRITICAL_SECTION' [BCC32 Error] WinApi.h(34): E2238 Multiple declaration for 'COORD' [BCC32 Error] WinApi.h(33): E2344 Earlier declaration of 'COORD' [BCC32 Error] WinApi.h(40): E2238 Multiple declaration for 'SMALL_RECT' [BCC32 Error] WinApi.h(39): E2344 Earlier declaration of 'SMALL_RECT' [BCC32 Error] WinApi.h(48): E2238 Multiple declaration for 'CONSOLE_SCREEN_BUFFER_INFO' [BCC32 Error] WinApi.h(47): E2344 Earlier declaration of 'CONSOLE_SCREEN_BUFFER_INFO' [BCC32 Error] WinApi.h(92): E2238 Multiple declaration for 'kActive'
So I have removed my hack from util.h. Please let me know what i can do further.
Thanks, Uttam
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SergiusTheBest/plog/issues/137?email_source=notifications&email_token=AGBHIT6WXTJBAX7M5RHNMK3QEQABHA5CNFSM4IKREWH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4IXXTA#issuecomment-521239500, or mute the thread https://github.com/notifications/unsubscribe-auth/AGBHITYDUMRYBECEHHWA4PDQEQABHANCNFSM4IKREWHQ .
--
Regards, Gord Tomlin
@gordhub No, #if 0 is correct (I wrote #if 1 first and then edited it).
Yes i have tried but that did not work. Below is the version i am currently using. CodeGear™ RAD Studio 2007 Version 11.0.2902.10471
Below is the code snippet that i am trying to compile.
#include
class test{
private : int num; public : test() {}; void setnum(); void getnum(): }; void test::setnum() { num = 10; } int test::getnum() { return num; }
main() {
test n1; n1.setnum(); n1.getnum(); }
I have included the below path in my project: C:\log\plog-rad-studio-compile-fix-137\include
I performed some testing on RAD Studio XE8 and the latest RAD Studio 10.3: both are working fine. Unfortunately I have no RAD Studio 2007 (it requires a license key and trial is not available). So you have to make a fix on your own.
Ok Thanks. I will try!