Hello world - linker errors


#1

hello folks,

I have precompiled JUCE1_28, with VC7 (.net 2003, WIN2K), set the pathes for
include (juce.h), and also for the executables, where the lib-file resides
(i need to admit, i don’t have the MS-Platform-SDK).

Then i made a blank sheet, only with:

[code]#pragma comment (lib, “jucelib_static_debug.lib”)

#include “stdafx.h”
#include “juce02.h”
#define MAX_LOADSTRING 100

#include <juce.h>
#include <juce_config.h>
[/code]

and got the 2 errors:

juce02 error LNK2019: not resolved external symbol '_WinMain@16', 
	referred to in function '_WinMainCRTStartup'
juce02 fatal error LNK1120: 1 not resolved external link

So that’s a linker-problem, but what to do?
Its required to link the *.lib as in the code (or at setup), that right?
What i cannot understand: its all in the lib, so why do i need the "juce.h"
still?
The blank main.cpp with the lib alone will not do?

Thanks for your effort
amando


#2

For now i’m going to ignore your bit about the platform SDK (i view that as pretty essential, but I will for now assume that you may know what you’re doing in that regard - I’ve not done anything involving precompiled headers). If it’s not to do with that, I would suggest the following:

It says that it can’t find a body for the winmain function. That means you’ve clearly got your project set to build a windows application.

When you say “Then i made a blank sheet, only with…”, that sounds like you don’t have any code for a JUCEApplication - which wraps up stuff like the windows main function. VC is trying to build an app for you according to the project settings, but there is no definition anywhere of the main function (because you have not got one). You can’t link compiled objects into a windows program with no main function!

So, a blank file won’t be enough, as it doesn’t have the definition of the body required to make the program. Just make a minimum implementation of a JUCEApplication and then you should be okay.

I could of course be totally wrong.


#3

Hello haydxn,

I have tried again with deriving from “JUCEApplication”, but did not help.
You don’t precompile? Hmmm… Interesting. I’ll try again at a later time. Anyway i need to download the new version finally.

/////// Latest news:
I have come across with a console project, like this (lib-path set again):

[code]#pragma comment (lib, “jucelib_static_debug.lib”)

#include “stdafx.h” // VC7 special
#include <juce.h>

int main()
{
return 0;
}[/code]

Obviously, the console is not the intention, but i can use the String, File, drawing at the desktop or a memory-image, and use the File classes.
That’s better than nothing, eh? :slight_smile:

thank you
amando


#4

it’s not just a case of deriving a class from JUCEApplication - have a look at the example project main.cpp file - it’s all there plain as day!

In particular, scroll down to see its minimal implementation of a JUCEApplication subclass - and also after it there is a very important macro used:

START_JUCE_APPLICATION (JUCEHelloWorldApplication)


#5

hello folks,

I am at the end of my power now. I have added the macro too, but did not help.

@haydxn: i also obtained your help-pdf and sample, that is nice of yours to write that, thanks a lot. I cannot get it running though. Also the console made hassles, as soon i added a String object.

Now, the very minimum is:

1 deriving from "JUCEApplcation"
2 adding the macro

So that’s really all then? Can someone post a code for the main, only with the true minimum?

kind greets
amando


#6

well you’re certainly going about things in a difficult order.

first things first- there are a bunch of example projects you can build provided with juce. in the juce ‘extras’ folder, try to build the ‘example project’ - that’s pretty much a minimal app. If you can’t get THAT to build, then you’re doing something wrong.

General procedure for getting started:

  • Pick and install an IDE (e.g. VC++express)

  • Install the PlatformSDK

  • Configure IDE directories for SDK

  • Unpack and build Juce (Debug and Release versions)

  • Configure IDE directories for Juce

  • BAM you’re ready

You’ve obviously gone a slightly different way to normal as you claim to not have the PSDK. Perhaps that’s your problem, I’m not sure. If you cannot build the example Hello World project, then I’d follow the normal procedure like everyone else does.


#7

Hello haydxn,

I am willing to comprehend the PSDK is desperatly required. Now that has 290 MB for download, ooff. But i will try get it anyway. Maybe i’ve made it more complicated than necessary, i’m not sure.
Many thanks for your help.

amando


#8