• Register
0 votes

Problem :

I am facing below error:

Severity Code Description Project File Line Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl imyNVoke_main(void)" (?imyNVoke_main@@YAHXZ) Severity Code Description Project File Line Error LNK1120 1 unresolved externals

Following is my code:

   #include "windows.h"
    #include "tchar.h"
    #include "d3d9.h"
    #pragma comment(lib, "d3d9.lib")
const int mysegment = 50;
const int myNV = mysegment*13;
   float x, y, z, rhv;
   DWORD color;
HRESULT InitialDirect3D(HWND hvnd)
      return E_FAIL;
   if(FAILED(pDirect3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &Display)))
      return E_FAIL;
   ZeroMemory(&Direct3DParameter, sizeof Direct3DParameter);
   if(FAILED(pDirect3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hvnd,
                                     &Direct3DParameter, &pDirect3DDevice)))
      return E_FAIL;
   return S_OK;
6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I have read your problem statement. I have understood the question.

I had also faced the same error in the recent past this is the rare case, but you can also face this error if you are trying to build the MFC application with CMake.

If that is the case, then you need to add the following definitions:

ADD_DEFINITIONS(-D_AFXDLL) SET(CMAKE_MFC_FLAG 2) # or 1 if you are looking for the static library

And if you are compiling with unicode, then the following properties also need to be added:



 And your issue will be resolved

9 7 4
38,600 points

Related questions

0 votes
1 answer 50 views
Been getting the following error when trying to compile my code: error LNK2019: unresolved external symbol "public: void __thiscall Agent::printSelf(void)" (?printSelf@Agent@@QAEXXZ) referenced in function "public: void __thiscall World::processMouse(int,int,int,int)" (? ... on this code in a long time, so im not sure what has changed to cause this. Anyone see anything wrong?
asked Oct 30, 2020 psandprop 2.4k points
0 votes
1 answer 8 views
Problem: Why do we use int main in C++? How does a main function in C++ differ from main in C? Why void main is wrong? How to know the exit status of your program. That's the reason why you have the int main() -- you return your exit status. It's wrong because this is not what the C++ Standard specifies as a legal main . Nobody cares about what the other languages specify?
asked Dec 12, 2020 Mashhoodch 5.7k points
0 votes
1 answer 11 views
What is the difference between void main() and int main() in c++?
asked Oct 9, 2020 sikandar 2.4k points
0 votes
1 answer 3 views
Problem: I run the following C codes and got a warning: control reaches end of non-void function int main(void) {}what does it mean? and if there is anything wrong that I havent noticed, please point it out
asked Dec 21, 2020 Mashhoodch 5.7k points
0 votes
1 answer 6 views
Problem: I've been getting strange compiler errors on this binary search algorithm. I get a warning that control reaches end of non-void function. What does this mean?
asked Dec 15, 2020 Mashhoodch 5.7k points
0 votes
1 answer 30 views
Problem: I have recently started learning C language as currently lockdown is going on so I am learning C language with the help of available online tutorials. I have managed to write the binary search algorithm. If I try to compile my binary search algorithm then I am facing very ... +1, high);     else if(val == sorted[mid])         return mid; } Please guide me in fixing my above C code.
asked Aug 1, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 166 views
Problem : I am learning C. If I try to compile my below code then I often face an error message as shown below “Warning: control may reach end of non-void function [-wreturn-type]”. How can I fix my below code to avoid above error message? Below is my code which is ... (board[r][c - 1] == 0)         {             return true;         }     }     else     {         return false;     } }
asked Apr 27, 2020 stewart 4k points
1 vote
1 answer 35 views
Problem: I am exploring the c++ programming language nowadays. It’s really interesting to learn new things every day. I was trying to adopt the methods in c++ but struggling to return values from a void method. I actually want to know that if it is ... a return statement in a void method. Thanks for your co-operation in this learning process. I really appreciate your effort. Thanks again.
asked Mar 25, 2020 Gavin 15.3k points
1 vote
1 answer 17 views
Problem: I am trying to make a program that will convert the temperature from Celcius to Fahrenheit and vice-versa. The sample code is attached below: #include <iostream> using namespace std; void dialouge(); int c2f(); int f2c(); int c2f() { int c; int choice; ... reaches end of non-void function what does it mean? and if there is anything wrong that I haven't noticed, please point it out.
asked Mar 9, 2020 Gavin 15.3k points
0 votes
1 answer 162 views
Problem: I have decent knowledge in C++. Here I am trying to write the quicksort please find below my C++ code: void swap(int& a, int& b); int mid(int lo, int hi); // Below is my quicksort implementation void sort(int vec[], int lo, int hi) {         int ... = mid(lo, hi);                     ~~~^ 1 error generated. Everything seems to be correct. Can someone help me in fixing my above C++ code?
asked Jul 22, 2020 Raphael Pacheco 4.9k points