Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used a GYP the Google's V8 source, to build and compile after all.sln generated dynamic library, to generate a lib file in the Debug & Release mode. (I've used Google's V8 source 5.4.0 version.)

I simply use the v8, and it outputs a run value of javascript.

I created a new win32 application console project in visual studio 2015 when you try to use the Google's V8.

That I know, it is sufficient to use a v8.lib file and v8_base.lib files and v8_nosnapshot.lib file.

1. I was generated v8_base_0.lib, v8_base_1.lib, v8_base_2.lib, the v8_base_3.lib. Do I use what v8_base.lib?
2. Do I need other lib file?

And I was used as whole copy the include directory in order to use the h file. I also, have copied the dll file(icu18n.dll, icuuc.dll, v8.dll).

I was used to copy the hello-world.cc source in the .cpp file.

However, Then compile a c ++ application source, an error occurs.

1>----- Build started: Project: v8Application2, Configuration: Debug Win32 -----
1> v8Application2.cpp
1>v8Application2.obj : error LNK2019: unresolved external symbol _main referenced in function"class v8::Platform * __cdecl v8::platform::CreateDefaultPlatform(int)" (?CreateDefaultPlatform@platform@v8@@YAPAVPlatform@2@H@Z) 1>c:\users\kito\documents\visual studio 2015\Projects\v8Application2\Debug\v8Application2.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


3. how do i do this problem?

I was upload the .vcxproj and .cpp files of c ++ application. Please check the visual studio 2015 'c++ win32 application console' project file.

And see also my other question Link.
I spent three weeks on this issue. Not going progress at all stuck here.

I there is a need for help that you are wrong in any way. Or ask the relevant link that corresponds to this.

This is the main source of the program.
I had to copy the main source from the example source.
I'm not part of the change separately.

C++
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "include/libplatform/libplatform.h"
#include "include/v8.h"

using namespace v8;

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

	V8::InitializeICUDefaultLocation(argv[0]);
	V8::InitializeExternalStartupData(argv[0]);
	Platform* platform = platform::CreateDefaultPlatform();
	V8::InitializePlatform(platform);
	V8::Initialize();

	// Create a new Isolate and make it the current one.
	Isolate::CreateParams create_params;
	create_params.array_buffer_allocator =
		v8::ArrayBuffer::Allocator::NewDefaultAllocator();
	Isolate* isolate = Isolate::New(create_params);
	{
		Isolate::Scope isolate_scope(isolate);

		// Create a stack-allocated handle scope.
		HandleScope handle_scope(isolate);

		// Create a new context.
		Local<Context> context = Context::New(isolate);

		// Enter the context for compiling and running the hello world script.
		Context::Scope context_scope(context);

		// Create a string containing the JavaScript source code.
		Local<String> source =
			String::NewFromUtf8(isolate, "'test' + ', test2!'",
				NewStringType::kNormal).ToLocalChecked();

		// Compile the source code.
		Local<Script> script = Script::Compile(context, source).ToLocalChecked();

		// Run the script to get the result.
		Local<Value> result = script->Run(context).ToLocalChecked();

		// Convert the result to an UTF8 string and print it.
		String::Utf8Value utf8(result);
		printf("%s\n", *utf8);
	}

	// Dispose the isolate and tear down V8.
	isolate->Dispose();
	V8::Dispose();
	V8::ShutdownPlatform();
	//delete platform;
	delete create_params.array_buffer_allocator;
	return 0;
}


What I have tried:

1. The "sln file", re-generate at other options.

2. demangling.

3. Add and remove the "lib file".
Posted
Updated 28-Aug-16 14:13pm
v6
Comments
Richard MacCutchan 26-Aug-16 6:18am    
You do not have a main method in your source file(s).
Kito87 28-Aug-16 20:14pm    
I have posted the delay main code.
Kito87 26-Aug-16 6:29am    
There is the overall solution to the link file. There is a 'main function' at 'Application2.cpp' in that.
Am I Additional to go home because it is outside. thank you.
Richard MacCutchan 29-Aug-16 2:48am    
There is nothing obviously wrong with your code, do you still get the same error? It may be that you need to go back to the V8 documentation and check what needs to be done.
Kito87 29-Aug-16 2:57am    
I seem to know what's wrong now. Is in the current test looks at the kind of things are missing some of the lib file. Thanks for your answer.

1 solution

You must make an entry in the project settings. It is a linker tab with a field for the libs to use. They must be somehow in the search path of the project or use an entry for the directory.

It can also be an namespace issue, but that for that you must consult the Google documentation.
 
Share this answer
 
Comments
Kito87 28-Aug-16 21:22pm    
I check the settings of the directory of the project properties. It looks like there is no problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900