Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2005-12-28 08:15:40


Support Requests item #1391956, was opened at 2005-12-28 05:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=207586&aid=1391956&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Embedded python won't compile

Initial Comment:
I followed the tutorial about embedding at
http://www.boost.org/libs/python/doc/tutorial/doc/html/python/embedding.html#python.using_the_interpreter
but I am now faced with some errors (VC++ 6.0, latest
Service Pack running on Windows 2000 SP4).

The errors:

Compiling...
StdAfx.cpp
Compiling...
pytest.cpp
f:\pytest\pytest.cpp(10) : error C2065: 'object' :
undeclared identifier
f:\pytest\pytest.cpp(10) : error C2146: syntax error :
missing ';' before identifier 'main_module'
f:\pytest\pytest.cpp(10) : error C2065: 'main_module' :
undeclared identifier
f:\pytest\pytest.cpp(11) : error C2065: 'handle' :
undeclared identifier
f:\pytest\pytest.cpp(11) : error C2059: syntax error : '>'
f:\pytest\pytest.cpp(13) : error C2146: syntax error :
missing ';' before identifier 'main_namespace'
f:\pytest\pytest.cpp(13) : error C2065:
'main_namespace' : undeclared identifier
f:\pytest\pytest.cpp(13) : error C2228: left of '.attr'
must have class/struct/union type
f:\pytest\pytest.cpp(15) : error C2059: syntax error : '>'
Error executing cl.exe.

pytest.exe - 9 error(s), 0 warning(s)

The code:

pytest.cpp
==========

// pytest.cpp : Defines the entry point for the console
application.
//

#include "stdafx.h"

int main(int argc, char* argv[])
{
        Py_Initialize();

    object main_module((
    handle<>(borrowed(PyImport_AddModule("__main__")))));

object main_namespace = main_module.attr("__dict__");

handle<> ignored((PyRun_String(

    "hello = file('hello.txt', 'w')\n"
    "hello.write('Hello world!')\n"
    "hello.close()"

  , Py_file_input
  , main_namespace.ptr()
  , main_namespace.ptr())
));

        Py_Finalize();

        return 0;
}

StdAfx.cpp
==========

// stdafx.cpp : source file that includes just the
standard includes
// pytest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type
information

#include "stdafx.h"

// TODO: reference any additional headers you need in
STDAFX.H
// and not in this file

StdAfx.h
========

// stdafx.h : include file for standard system include
files,
// or project specific include files that are used
frequently, but
// are changed infrequently
//

#if
!defined(AFX_STDAFX_H__14167E34_D56C_4B80_BB18_4CB7F7E8E058__INCLUDED_)
#define
AFX_STDAFX_H__14167E34_D56C_4B80_BB18_4CB7F7E8E058__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used
stuff from Windows headers

#include <stdio.h>
#include "boost\python.hpp"
using namespace std;

// TODO: reference additional headers your program
requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional
declarations immediately before the previous line.

#endif //
!defined(AFX_STDAFX_H__14167E34_D56C_4B80_BB18_4CB7F7E8E058__INCLUDED_)

Libs
====

kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
python24.lib boost_python.lib

Please help, I would VERY much appreciate it- good job
with all the hard work on Boost.Python!

My email address is jamclx_at_[hidden]

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=207586&aid=1391956&group_id=7586

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk