Syntax error in cef's header file

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Syntax error in cef's header file

Postby SinnerSmile » Sun Aug 25, 2013 8:27 am

Hello gentlemen.
I'm trying to build a simple win32 application with CEF in it.
Yesterday i was struggling with a tons of errors.
I downloaded 64bit CEF binary, i was changing progect properties from win32 to x64, downloading and installing last SDK for win 7 (i'm using VC++ 2010 Express), getting errors again, realising that i'm on Win 8 (doh) and installing SDK for 8, i was building cefclient app to get win_dll_wrapper.lib, then took libcef.lib and ..wrapper.lib to my progect folder and link VC to them, now as all windows header and x64 related errors are gone i'm struck at this:
Code: Select all
1>  Testing2.cpp
1>c:\users\max\documents\visual studio 2010\projects\testing\testing\include/cef_dom.h(274): warning C4003: not enough actual parameters for macro 'GetNextSibling'
1>c:\users\max\documents\visual studio 2010\projects\testing\testing\include/cef_dom.h(274): error C2059: syntax error : ','
1>c:\users\max\documents\visual studio 2010\projects\testing\testing\include/cef_dom.h(286): warning C4003: not enough actual parameters for macro 'GetFirstChild'


My code:
Code: Select all
#include <Windowsx.h>
#include "include/cef_app.h"
#include "bareboneshandler.h"
#pragma comment(lib,"user32.lib")



CefRefPtr<BareBonesHandler> cf_handler;

LRESULT CALLBACK WinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);


int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nShowCmd)
{
   WNDCLASSEX wClass;
   CefSettings settings;
    cf_handler = new BareBonesHandler();

   CefMainArgs main_args(hInst);


   ZeroMemory(&wClass,sizeof(WNDCLASSEX));
   wClass.cbClsExtra=NULL;
   wClass.cbSize=sizeof(WNDCLASSEX);
   wClass.cbWndExtra=NULL;
   wClass.hbrBackground=(HBRUSH)COLOR_WINDOW;
   wClass.hCursor=LoadCursor(NULL,IDC_ARROW);
   wClass.hIcon=NULL;
   wClass.hIconSm=NULL;
   wClass.hInstance=hInst;
   wClass.lpfnWndProc=(WNDPROC)WinProc;
   wClass.lpszClassName="Window Class";
   wClass.lpszMenuName=NULL;
   wClass.style=CS_HREDRAW|CS_VREDRAW;

   if(!RegisterClassEx(&wClass))
   {
      int nResult=GetLastError();
      MessageBox(NULL,
         "Window class creation failed",
         "Window Class Failed",
         MB_ICONERROR);
   }

   
    int exitCode = CefExecuteProcess(main_args, NULL);
    if (exitCode >= 0) {
    return exitCode;
    }

   CefInitialize(main_args, settings, NULL);

   HWND hWnd=CreateWindowEx(NULL,
         "Window Class",
         "Testing Window",
         WS_OVERLAPPEDWINDOW,
         200,
         200,
         1280,
         768,
         NULL,
         NULL,
         hInst,
         NULL);

   if(!hWnd)
   {
      int nResult=GetLastError();

      MessageBox(NULL,
         "Window creation failed",
         "Window Creation Failed",
         MB_ICONERROR);
   }

   ShowWindow(hWnd,nShowCmd);

   MSG msg;
   ZeroMemory(&msg,sizeof(MSG));

   
   CefRunMessageLoop();
    CefShutdown();
   return 0;
}

LRESULT CALLBACK WinProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
   switch(msg)
   {
      

   case WM_DESTROY:
      {
         CefQuitMessageLoop();
         PostQuitMessage(0);
         return 0;
      }
      break;

   case WM_CREATE:
      {
        RECT rect;
        GetClientRect(hWnd, &rect);
      CefWindowInfo info;
      info.SetAsChild(hWnd, rect);
      CefBrowserSettings settings;
      
      CefBrowserHost::CreateBrowserSync(info, cf_handler.get(),
      "http://code.google.com", settings);



      
      }
      break;

   case WM_COMMAND:
      {
      
      }
      break;
      
   }


   return DefWindowProc(hWnd,msg,wParam,lParam);
}
SinnerSmile
Techie
 
Posts: 34
Joined: Sun Aug 25, 2013 8:07 am

Re: Syntax error in cef's header file

Postby magreenblatt » Sun Aug 25, 2013 10:51 am

Either use windows.h instead of windowsx.h or #undef the conflicting macro definitions before including CEF headers.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Syntax error in cef's header file

Postby SinnerSmile » Sun Aug 25, 2013 1:27 pm

After trying to put windows.h instead of windowsx.h I'm getting this:
Code: Select all
1>  Testing2.cpp
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __cdecl std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QEAA@XZ) already defined in libcef_dll_wrapper.lib(v8handler_cpptoc.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __cdecl std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QEAA@XZ) already defined in libcef_dll_wrapper.lib(v8handler_cpptoc.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __cdecl std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QEAAXXZ) already defined in libcef_dll_wrapper.lib(v8handler_cpptoc.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_ShowWindow referenced in function WinMain
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_CreateWindowExA referenced in function WinMain
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_MessageBoxA referenced in function WinMain
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_GetLastError referenced in function WinMain
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_RegisterClassExA referenced in function WinMain
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_LoadCursorA referenced in function WinMain
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_DefWindowProcA referenced in function "__int64 __cdecl WinProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WinProc@@YA_JPEAUHWND__@@I_K_J@Z)
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_GetClientRect referenced in function "__int64 __cdecl WinProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WinProc@@YA_JPEAUHWND__@@I_K_J@Z)
1>Testing2.obj : error LNK2019: unresolved external symbol __imp_PostQuitMessage referenced in function "__int64 __cdecl WinProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WinProc@@YA_JPEAUHWND__@@I_K_J@Z)
1>MSVCRTD.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp_EncodePointer referenced in function _onexit
1>MSVCRTD.lib(crtexew.obj) : error LNK2001: unresolved external symbol __imp_EncodePointer
1>MSVCRTD.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp_DecodePointer referenced in function _onexit
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp_Sleep referenced in function __tmainCRTStartup
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp_GetStartupInfoW referenced in function __tmainCRTStartup
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_WideCharToMultiByte referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPEAXHHPEBD@Z)
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_IsDebuggerPresent referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPEAXHHPEBD@Z)
1>MSVCRTD.lib(gs_report.obj) : error LNK2001: unresolved external symbol __imp_IsDebuggerPresent
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_MultiByteToWideChar referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPEAXHHPEBD@Z)
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_RaiseException referenced in function "int __cdecl DebuggerProbe(unsigned long)" (?DebuggerProbe@@YAHK@Z)
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_lstrlenA referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPEAXPEAU_RTC_ALLOCA_NODE@@H@Z)
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_GetProcAddress referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPEAXPEAU_RTC_ALLOCA_NODE@@H@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2001: unresolved external symbol __imp_GetProcAddress
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp_LoadLibraryW referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPEAXPEAU_RTC_ALLOCA_NODE@@H@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2001: unresolved external symbol __imp_LoadLibraryW
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_TerminateProcess referenced in function __report_gsfailure
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentProcess referenced in function __report_gsfailure
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_UnhandledExceptionFilter referenced in function __report_gsfailure
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_SetUnhandledExceptionFilter referenced in function __report_gsfailure
1>MSVCRTD.lib(unhandld.obj) : error LNK2001: unresolved external symbol __imp_SetUnhandledExceptionFilter
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol RtlVirtualUnwind referenced in function __report_gsfailure
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol RtlLookupFunctionEntry referenced in function __report_gsfailure
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp_RtlCaptureContext referenced in function __report_gsfailure
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_QueryPerformanceCounter referenced in function __security_init_cookie
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetTickCount referenced in function __security_init_cookie
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentThreadId referenced in function __security_init_cookie
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetCurrentProcessId referenced in function __security_init_cookie
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp_GetSystemTimeAsFileTime referenced in function __security_init_cookie
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp_HeapFree referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPEAEPEA_WKPEAH1K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp_HeapAlloc referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPEAEPEA_WKPEAH1K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp_GetProcessHeap referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPEAEPEA_WKPEAH1K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp_GetModuleFileNameW referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPEAEPEA_WKPEAH1K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp_VirtualQuery referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPEAEPEA_WKPEAH1K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp_FreeLibrary referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
1>C:\Users\Max\documents\visual studio 2010\Projects\Testing\x64\Debug\Testing.exe : fatal error LNK1120: 38 unresolved externals


I'm realy C++ and Win32 newbie, so pardon me, but can You be a little more specific, how can I find out what definitions are conflicting and what I need to #undef?
SinnerSmile
Techie
 
Posts: 34
Joined: Sun Aug 25, 2013 8:07 am

Re: Syntax error in cef's header file

Postby magreenblatt » Sun Aug 25, 2013 6:23 pm

You may have an easier time using the 32-bit build. Start with the cefclient project as a working example.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Syntax error in cef's header file

Postby SinnerSmile » Mon Aug 26, 2013 9:45 am

Perhabs x32 will be easier, but as I already start messing with x64 and seems just need few steps more to get rid of this errors and succesfully compile it, that's why I want to figure out how to make work that x64 build.
SinnerSmile
Techie
 
Posts: 34
Joined: Sun Aug 25, 2013 8:07 am

Re: Syntax error in cef's header file

Postby SinnerSmile » Tue Aug 27, 2013 4:48 pm

Was digging a bit in cefclient2010 for x64, truly this example simply an overkill for such a small basic pile of code, that i'm trying to compile, yet I'm sincerely asking for some help with my compilation problems.
SinnerSmile
Techie
 
Posts: 34
Joined: Sun Aug 25, 2013 8:07 am

Re: Syntax error in cef's header file

Postby magreenblatt » Tue Aug 27, 2013 4:55 pm

Did you set the runtime configuration on the libcef_dll_wrapper project to match your executable project configuration? See https://code.google.com/p/chromiumembed ... eLibraries

There are also a number of bare bones examples available by googling "CEF bare bones".
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Syntax error in cef's header file

Postby SinnerSmile » Thu Aug 29, 2013 2:46 pm

Yes, _dll_wrapper and my progect flags now match, but those link errors still here, i think i need to try x32.
SinnerSmile
Techie
 
Posts: 34
Joined: Sun Aug 25, 2013 8:07 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 100 guests