Asterisk and pointer conversion

Hello, all
I am pretty new to C++ but have some experience with Java and other programming language. Currently I am having some problem with the the asterisk and pointers. The project is to develop a math equation rendering engine, using MathJax and env.js. I got a envjsnatives.cpp file from QT platform. In the file, there is a function called initializeEnvjsNatives.

  // Exported API.
void initializeEnvjsNatives(QScriptEngine *);

I included the cpp file and called the function with a engine object (if I am correct.) see partial code.
#include "envjsnatives.cpp"
    QString scriptFileName(":/env.js");
    QFile scriptFile(scriptFileName);;
    engine.evaluate(scriptFile.readAll(), scriptFileName);

When I build the project, I got this
main.cpp:20: error: cannot convert 'QScriptEngine' to 'QScriptEngine*' for 
argument '1' to 'void initializeEnvjsNatives(QScriptEngine*)'

What's the problem? I think it is the pointer conversion.
Last edited on
The error message is clear enough. Instead of the object itself you should use a pointer to the object as the function argument.
I only wonder do you have indeed some experience with Java and other programming languages?!
Last edited on
At least I finished Java computer science AP course and passed Google Code Jam qualification round using java. And I know this is a pretty stupid question, so I posted in the beginner section.
Last edited on
> I included the cpp file
You shouldn't include *.cpp (function definitions), it will give you a multiple definition error.
Use the linker instead
I realized that problem after I fixed the pointer. Unfortunately, that file doesn't come with a .h
It's not supposed to come with a .h, and you're still not supposed to #include the .cpp
I created a .h with what I need.
Topic archived. No new replies allowed.