Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:17:07+00:00 2026-06-09T03:17:07+00:00

This is the first question I have found myself not being able to get

  • 0

This is the first question I have found myself not being able to get to the bottom of using my normal googling/stack overflowing/youtubing routine.

I am trying to compile a minimal Lua program inside of a C++ environment just to ensure my environment is ready to development. The Lua language will be later used for User Interface programming for my C++ game.

First some basic information on my environment:

Windows 7 64-bit

Visual studio 2010

Lua for Windows 5.1 (latest build I could download from google code)

Here is the code I am trying to compile:

// UserInt.cpp : Defines the entry point for the console application.
//
#pragma comment(lib,"lua5.1.dll")
#include "stdafx.h"
#ifndef __LUA_INC_H__
#define __LUA_INC_H__

extern "C"
{
   #include "lua.h"
   #include "lauxlib.h"
   #include "lualib.h"
}



int _tmain(int argc, _TCHAR* argv[])
{
    lua_State * ls = luaL_newstate();
    return 0;
}

#endif // __LUA_INC_H__

Here is the Error I am getting:

1>UserInt.obj : error LNK2019: unresolved external symbol _luaL_newstate referenced in function _wmain
1>c:\users\deank\documents\visual studio 2010\Projects\UserInt\Debug\UserInt.exe : fatal error LNK1120: 1 unresolved externals

Things I have tried:

I have read about lua_open()(and several other functions) no longer being used so I tried the newstate function instead. I get the same error. This was more of a sanity check than anything. I am using 5.1 and not 5.2 so I do not think this really matters.

I have also read this thread Cannot link a minimal Lua program but it does not seem to help me because I am not running the same environment as that OP. I am on a simple windows 7 and visual studio environment.

The top pragma comment line was something I saw in yet another thread. I get the same error with or without it.

I have gone into my visual studio C++ directories area and added the lua include to the includes and the lua lib to the libraries.

So it seems like my program is seeing the .h and seeing the symbol. But for some reason it is not getting the .cpp implementation for the functions. This is why I was hoping including that .dll directly would help fix the problem, but it hasn’t.

So, I feel like I have exhausted all of my options solving this on my own. I hope someone is able to help me move forward here. Lua looks like an awesome language to script in and I would like to get my environment squared away for development.

I hope it is just some silly error on my part. I believe I have provided as much information as I can. If you need more specifics I will update with info if I can provide it.

Edit1

Tried the solution in this Can't build lua a project with lua in VS2010, library issue suspected

That did not work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:17:10+00:00Added an answer on June 9, 2026 at 3:17 am

    You’ll need to have the library (.LIB) file and add that to VS. Use Project > Properties and go to Linker > Input and add the full .lib filename to the “Additional Dependencies” line. Note that the .LIB is different from the .DLL.

    Personally, I prefer adding the source code to my project, over referencing the dynamic link library. The following procedure will let you do as such.

    1. Download the source code ( http://www.lua.org/ftp/ ), uncompress it.

    2. In Visual Studio, choose File > New > Project and choose Visual C++, Win32, “Win32 Console Application”.

    3. In your project in Visual Studio, add all the source code, except luac.c. Also delete the main() function out of the file that VS created for you. This is usually given the name of the project you specified with the .cpp file extension. You could just remove this file all-together from the project.

    4. Build and Run.

    This is the Lua console

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time using StackOverflow myself. I have found many answers to
Hello this is may first question and I have found so far the following
this is my first question I have searched for any launching activity questions and
This is my first question. I have an app in which i want to
this is my first question.. so, here we go. i have a site, 100%
though I have visited this site many times, this is my first question. After
this is my first time posting here, I have a question which I have
Sorry, this's my first time to ask a question here. So, I don't have
I have this view (DetailsContainer, first class in code section of this question) with
I ask this question expecting the answer to be 'not possible', as I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.