[odb-users] Compile Error using Hello Example

Sukhbir Singh linux_sle at yahoo.co.uk
Thu Jul 19 16:12:52 EDT 2012






>________________________________
> From: Sukhbir Singh <linux_sle at yahoo.co.uk>
>To: Sukhbir Singh <linux_sle at yahoo.co.uk>; Boris Kolpackov <boris at codesynthesis.com> 
>Cc: "odb-users at codesynthesis.com" <odb-users at codesynthesis.com> 
>Sent: Thursday, 19 July 2012, 20:43
>Subject: Re: [odb-users] Compile Error using Hello Example
> 
>
>
>
>
>
>
>>________________________________
>> From: Sukhbir Singh <linux_sle at yahoo.co.uk>
>>To: Boris Kolpackov <boris at codesynthesis.com> 
>>Cc: "odb-users at codesynthesis.com" <odb-users at codesynthesis.com> 
>>Sent: Thursday, 19 July 2012, 19:05
>>Subject: Re: [odb-users] Compile Error using Hello Example
>> 
>>From: Boris Kolpackov <boris at codesynthesis.com>
>>
>>To: Sukhbir Singh <linux_sle at yahoo.co.uk> 
>>Cc: "odb-users at codesynthesis.com" <odb-users at codesynthesis.com> 
>>Sent: Thursday, 19 July 2012, 8:41
>>Subject: Re: [odb-users] Compile Error using Hello Example
>>
>>Hi Sukhbir,
>>
>>Sukhbir Singh <linux_sle at yahoo.co.uk> writes:
>>
>>> This error also results if the example in "hello"
 folder is compiled 
>>> following the instructions in the manual. Running "c++ -c person-odb.cxx"
>>> compiles with no error. However, running "c++ -c driver.cxx" results in
>>> an error with the message 'db' is out of scope.
>>
>>Can you show the complete error message that you see (i.e., everything
>>from the "c++ -c driver.cxx" command until the shell prompt).
>>
>>The output is:
>>
>>1) sudhir at LinuxServer:~/Downloads/dump/odb/odb-examples-2.0.0/hello> c++ -c driver.cxx
>>2) In file included from driver.cxx:10:0:
>>2) database.hxx: In function ‘std::auto_ptr<odb::database> create_database(int&, char**)’:
>>2) database.hxx:89:10: error: ‘db’ was not declared in this scope
>>
>>
>>Also, can you send the output of these two commands:
>>
>>c++ --version
>>
>>c++ (SUSE Linux) 4.6.2
>>Copyright (C) 2011 Free Software Foundation, Inc.
>>This is free software; see the source for copying conditions. 
 There is NO
>>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
>>g++ --version
>>
>>g++ (SUSE Linux) 4.6.2
>>Copyright (C) 2011 Free Software Foundation, Inc.
>>This is free software; see the source for copying conditions.  There is NO
>>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
>>Hope this helps.
>>
>>
>>
>>Further to my earlier message, the issue was fixed by amending the include for database.hxx from "database.hxx" to <odb/mysql.database.hxx> AND changing the line
>>
>>auto_ptr<database> db (create_database (argc, argv));
>>
>>to
>>auto_ptr<database> db (new odb::mysql::database ("odb_test", "odb_test", "odb_test"));
>>
>>After these amendments, the files compiled and executed without any problems.  On running the make file included with the examples in the "hello" directory, libtool is used and perhaps this fixes the error.
>>
>>Hope
 this is useful for anyone having the same problems I did.
>>
>>Sudhir
>>
>>
>>
>The example successfully compiled at last.  The fix was to define DATABASE_MYSQL in the database.hxx file in the hello directory.  After this, the example compiles fine and runs without problems.
>
>
>Sudhir


More information about the odb-users mailing list