Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Definition of dllimport function not allowed" for clear project #20400

Open
BonBonSlick opened this issue Dec 6, 2019 · 3 comments
Open

Comments

@BonBonSlick
Copy link

BonBonSlick commented Dec 6, 2019

  • cocos2d-x v3.17.2:
  • devices test on: PC
  • developing environments
    • NDK none:
    • Xcode none:
    • VS 2019 Community 16.3.10
    • chrome:
  • all build toold are default

Steps to Reproduce:

  1. Install VS 2019 Community
  2. Install python v 2.7.17
  3. unpack cocos
  4. cocos new test -l cpp
  5. compile project
  6. see the error list

First error of 3 leads to https://github.com/irontec/Ikasesteka/blob/master/Ikasesteka/cocos2d/cocos/base/CCConsole.h#L60

@rh101
Copy link
Contributor

rh101 commented Dec 19, 2019

If you used the default Visual Studio project in the proj.win32 folder, then that may be the problem.

Create a new project with CMake. Install CMake on your system, then follow the instructions here:
https://github.com/cocos2d/cocos2d-x/tree/v3/cmake

For VS2019, you can use this to generate the Win32 project:

mkdir win32build
cd .\win32build
cmake .. -G"Visual Studio 16 2019" -Tv142 -A Win32

@BonBonSlick
Copy link
Author

I use now cocos2d-x v 4.0 as it outperforms v 3.17. Creating a clear win 32 project with Cmake displays now other default errors in error log.

Windows 10
VS 2019


Severity	Code	Description	Project	File	Line	Suppression State	Suppression State

Error (active)	E0130	expected a '{'	test	C:\Cocos_2D\Games\test\cocos2d\cocos\base\CCConsole.h	63		

Error (active)	E0130	expected a '{'	test	C:\Cocos_2D\Games\test\cocos2d\cocos\base\ccUTF8.h	66		

@rh101
Copy link
Contributor

rh101 commented Jan 5, 2020

Do a test:

  1. Open a command prompt
  2. Change directory to the cocos2d cpp-tests folder, for instance:
    [installation path]\tests\cpp-empty-test
  3. Type each of these lines in the command window:
mkdir win32build
cd .\win32build
cmake .. -G"Visual Studio 16 2019" -Tv142 -A Win32
  1. Now go into the win32build folder that was created at step 3, and open the solution file cpp-empty-test.sln in Visual Studio 2019.
  2. Right click the cpp-empty-test project and set it as your start-up project.
  3. Build and run.

See if that works. If it does, then the issue you're having is in your own code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants