1>------ Build started: Project: DirectXtutrials, Configuration: Debug Win32 ------
1>Build started 3/24/2011 5:24:05 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\DirectXtutrials.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Konnor\Documents\Visual Studio 2010\Projects\DirectXtutrials\Debug\DirectXtutrials.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:07.66
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So that's whats wrong with my code. The source code doesn't matter because i've tried multiple source codes and it still doesn't work. I'm trying to learn directX 10 and for some reason its not compiling. Does anyone know what i should do?

It seems like the linker thinks there is no int main() function..., what does you main look like?

It seems like the linker thinks there is no int main() function..., what does you main look like?

This code below is the exact code from a book on DirectX 10 I'm working out of...

// Basic Direct-X program
#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	MessageBox(NULL, "This is a sample program for windows API!", "EXAMPLE", MB_OK | MB_ICONEXCLAMATION);
}

As you can see there is no int main() function. What do i need to do to get a direct X 10 program to compile?

I believe it has to do with whether your project is a console versus a win32 app. You can check this in the project->properties under linker->system. The "system" must be Windows and NOT console.

commented: Thanks +1

I believe it has to do with whether your project is a console versus a win32 app. You can check this in the project->properties under linker->system. The "system" must be Windows and NOT console.

Yep that was it. Thanks man!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.