First project

I’ve run Introjucer, loaded the project in MSVC++ 2010 and the build fails with:

[quote]1> Main.cpp
1>c:\projects\juce\projectx\source\main.cpp(16): error C2504: ‘JUCEApplication’ : base class undefined
1>c:\projects\juce\projectx\source\main.cpp(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\juce\projectx\source\main.cpp(28): error C2143: syntax error : missing ‘,’ before '&'
1>c:\projects\juce\projectx\source\main.cpp(47): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\juce\projectx\source\main.cpp(47): error C2146: syntax error : missing ‘;’ before identifier 'getApplicationName’
1>c:\projects\juce\projectx\source\main.cpp(48): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\juce\projectx\source\main.cpp(50): warning C4183: ‘getApplicationName’: missing return type; assumed to be a member function returning 'int’
1>c:\projects\juce\projectx\source\main.cpp(52): error C2327: ‘projectxApplication::String’ : is not a type name, static, or enumerator
1>c:\projects\juce\projectx\source\main.cpp(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\juce\projectx\source\main.cpp(52): error C2146: syntax error : missing ‘;’ before identifier 'getApplicationVersion’
1>c:\projects\juce\projectx\source\main.cpp(52): error C2086: ‘const int projectxApplication::String’ : redefinition
1> c:\projects\juce\projectx\source\main.cpp(47) : see declaration of 'projectxApplication::String’
1>c:\projects\juce\projectx\source\main.cpp(53): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\juce\projectx\source\main.cpp(55): warning C4183: ‘getApplicationVersion’: missing return type; assumed to be a member function returning 'int’
1>c:\projects\juce\projectx\source\main.cpp(62): error C2327: ‘projectxApplication::String’ : is not a type name, static, or enumerator
1>c:\projects\juce\projectx\source\main.cpp(62): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\juce\projectx\source\main.cpp(62): error C2143: syntax error : missing ‘,’ before '&'
1>c:\projects\juce\projectx\source\main.cpp(69): warning C4512: ‘projectxApplication’ : assignment operator could not be generated
1> c:\projects\juce\projectx\source\main.cpp(15) : see declaration of 'projectxApplication’
1>c:\projects\juce\projectx\source\main.cpp(19): error C2758: ‘projectxApplication::String’ : must be initialized in constructor base/member initializer list
1> c:\projects\juce\projectx\source\main.cpp(47) : see declaration of 'projectxApplication::String’
1>c:\projects\juce\projectx\source\main.cpp(43): error C3861: ‘quit’: identifier not found
1>c:\projects\juce\projectx\source\main.cpp(49): error C2440: ‘return’ : cannot convert from ‘const char [19]’ to 'int’
1> There is no context in which this conversion is possible
1>c:\projects\juce\projectx\source\main.cpp(54): error C2440: ‘return’ : cannot convert from 'const char *const ’ to 'int’
1> There is no context in which this conversion is possible
1>c:\projects\juce\projectx\source\main.cpp(73): error C2440: ‘return’ : cannot convert from ‘projectxApplication *’ to 'juce::JUCEApplicationBase *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast[/quote]

The project includes lots of Juce Modules and library code, but it seems paths are off in the sln created by Introjucer.

Introjucer 3.0.0, Juce 2.0.

Thanks

Hard to tell without seeing the code, but you don’t seem to be including any juce headers…?

Hi jules, thanks for replying!

I didn’t write any code, this is the vanilla main.cpp generated by Introjucer.

[quote]/*

This file was auto-generated by the Introjucer!

It contains the basic startup code for a Juce application.

==============================================================================
*/

#include “…/JuceLibraryCode/JuceHeader.h”

//==============================================================================
class projectxApplication : public JUCEApplication
{
public:
//==============================================================================
projectxApplication()
{
}

~projectxApplication()
{
}

//==============================================================================
void initialise (const String& commandLine)
{
    // Do your application's initialisation code here..
    
}

void shutdown()
{
    // Do your application's shutdown code here..
    
}

//==============================================================================
void systemRequestedQuit()
{
    quit();
}

//==============================================================================
const String getApplicationName()
{
    return "ProjectX";
}

const String getApplicationVersion()
{
    return ProjectInfo::versionString;
}

bool moreThanOneInstanceAllowed()
{
    return true;
}

void anotherInstanceStarted (const String& commandLine)
{
    
}

private:

};

//==============================================================================
// This macro generates the main() routine that starts the app.
START_JUCE_APPLICATION(projectxApplication)
[/quote]

Ok, the problem occurs if I include DONT_SET_USING_JUCE_NAMESPACE in Introjucer “Preprocessor definitions” textbox. Without this define, the project compiles.

Well yeah… If you’re going to set that flag, then you’d need to edit the code to explicitly use the namespace everywhere.